首次发布npm模块不下载依赖项

时间:2014-11-29 16:08:59

标签: node.js package npm

我刚刚发布了我的npm包。但现在当我使用sudo npm install package-name -g安装它时,它确实下载了包,但没有下载它的依赖项。我知道这一点,因为当我执行这个包命令packagename path/to/folder时,会显示有关它Error: Cannot find module 'hound'的依赖关系的错误。猎犬是它的依赖。下面是我的package.json文件

{
  "name": "package-name",
  "description": "description",
  "version": "0.1.1",
  "homepage": "url",
  "author": {
    "name": "Name",
    "email": "email@gmail.com"
  },
  "repository": {
    "type": "git",
    "url": "url to git"
  },
  "bugs": {
    "url": "url/issues"
  },
  "licenses": [
    {
      "type": "MIT",
      "url": "url to LICENSE-MIT"
    }
  ],
  "main": "lib/package-name",
  "engines": {
    "node": "0.10.32"
  },
  "devDependencies": {
    "hound": "1.0.4",
    "async": "0.9.0",
    "replace": "0.3.0",
    "grunt": "~0.4.5",
    "node-dir": "0.1.6"
  },
  "keywords": [],
  "preferGlobal": "true",
  "bin": {
    "cssimport" : "lib/package-name.js"
  }
}

如何更改此设置,以便在用户安装我的软件包时,其依赖项会自动下载并开始工作?

1 个答案:

答案 0 :(得分:1)

Hound被设置为devDepency,它不会安装在正常安装中。如果将其更改为依赖项,它将是。如果您需要某些东西作为devDependencies来构建您的包(如grunt),请将它们留在该密钥下。