【问题标题】:Execution of a node package command not working on Ubuntu 12.04 RTS执行节点包命令在 Ubuntu 12.04 RTS 上不起作用
【发布时间】:2014-12-07 19:37:37
【问题描述】:

我创建了一个 npm 包,这是 package.json

{
  "name": "docxgen",
  "version": "1.0.5",
  "author": "Hans Thunam <hans.thunam@gmail.com>",
  "description": "A docX Generator",
  "contributors": [ 
    {
      "name": "",
      "email": ""
    } 
  ],
  "bin":
  {
    "docxgen":"./docxgenNode/bin/docxgen"
  },
  "keywords": [
    "DocX",
    "templates",
    "Generator"
  ],
  "dependencies" : {
    "xmldom"   :  "0.1.x"
  },
  "devDependencies": {
    "jasmine-node":"1.10.x"
  }, 
  "license": "MIT",
  "engines": {
    "node": ">=0.8"
  }
}

然后我在package.json的文件夹中做了sudo npm install -g,安装正常(没有错误也没有警告)。

但是,当我尝试执行 docxgen file.docx file.json 时,我得到了响应:找不到文件或命令。奇怪的是它可以在 Windows 7 上运行。

对于 Ubuntu 有什么不同的吗?

【问题讨论】:

  • 可执行路径为./docxgenNode/bin/docxgen。所以在执行时给出路径。

标签: node.js ubuntu npm


【解决方案1】:

问题在于./docxgenNode/bin/docxgen 的字符编码。

shell 系统没有正确读取第一行。

我从可以在此处找到的现有工作二进制文件开始:https://github.com/LearnBoost/stylus/blob/master/bin/stylus

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-01
    • 2013-10-24
    • 1970-01-01
    相关资源
    最近更新 更多