NPM不发布依赖项

时间:2015-07-03 23:38:37

标签: json node.js npm command-line-interface

我一直在使用Node和npm Packages作为CLI应用程序。我有一个带有package.json的项目,所有项目都正确填写。当我通过WebStorm运行具有不同参数的应用程序时,一切正常。如果我发布npm包但是...没有依赖... npm站点找不到一个..当我安装CLI应用程序时,它运行失败因为是的...依赖项没有被拉入......

这是我的package.json

 {
  "name": "wmg",
  "version": "0.0.8",
  "description": "A Commandline Foolin around",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/Arvraepe/wmg.git"
  },
  "keywords": ["Stuff", "Foolin"],
  "target": "main",
  "preferGlobal": true,
  "bin": {
    "wmg": "wmg.js"
  },
  "author": "Arne Van Raepenbusch <arvraepe@gmail.com>",
  "license": "ISC",
  "devDependencies": {
    "prompt": "^0.2.14",
    "restify": "^3.0.3",
    "underscore": "^1.8.3"
  }
}

我试过运行pakmanager deps,但这给了我这个奇怪的错误

======================= WARNING =======================
Assuming browser mode by default is deprecated.
  Include browserDependencies in your package.json
  -- OR --
  pakmanager -e browser build

In the next release of pakmanager, the node environment will be assumed as default
=======================================================


Targeted Environment: browser
[[[deps]]]
[ERROR] The following packages are `require`d, but not in the package, nor on npm:
  wmg
pakmanager {}


======================= WARNING =======================
Assuming browser mode by default is deprecated.
  Include browserDependencies in your package.json
  -- OR --
  pakmanager -e browser build

In the next release of pakmanager, the node environment will be assumed as default
=======================================================

我的包裹当然不应该依赖自己吗?

有人可以对此有所了解吗?

2 个答案:

答案 0 :(得分:2)

我看了你的包裹,正如其他人已经注意到你列出了devDependencies但没有dependencies。通常devDependencies用于测试框架之类的东西,您需要在包上工作但不要使用它。 {/ 1}}和prompt都在您的应用中使用,应该列在restify对象中,而不是dependencies

答案 1 :(得分:1)

您的package.json文件不包含任何依赖项。只有开发时才需要npm假定的devDependencies(例如mocha),安装时不需要。

如果您的任何devDependencies是实际的用户依赖项,则将它们移动到依赖项。