npm在安装我未指定的模块时出错

时间:2015-09-21 13:17:29

标签: node.js npm gulp

我正在尝试使用

安装我的应用程序所需的模块
npm install 

当我这样做时,我收到以下错误:

npm ERR! Error: No compatible version found: gulp-util@'^3.0.0'
npm ERR! Valid install targets:
npm ERR! ["0.0.1","1.0.0","1.1.0","1.1.1","1.2.0","1.3.0","2.0.0","2.1.1","2.1.2","2.1.3","2.1.4","2.2.0","2.2.1","2.2.2","2.2.3","2.2.5","2.2.6","2.2.7","2.2.8","2.2.9","2.
2.10","2.2.11","2.2.12","2.2.13","2.2.14","2.2.15","2.2.16","2.2.17","2.2.18","2.2.19","2.2.20","3.0.0","3.0.1","3.0.2","3.0.3","3.0.4","3.0.5","3.0.6"]

但是,我从不要求将此模块放入我的项目中。 我假设它是npm或节点内部的问题。

此外,当我跑

时也很奇怪
npm list -g

我得到以下输出,而不是看到已安装的npm版本。

├── node@0.0.0

我的package.json文件是:

{
  "name": "myProject",
  "version": "0.0.1",
  "dependencies": {},
  "scripts": {
    "test": "gulp test"
  },
  "devDependencies": {
    "browserify": ">=9.0.7",
    "gulp": ">=3.8.11",
    "gulp-concat": ">=2.6.0",
    "gulp-html-replace": ">=1.5.1",
    "gulp-react": ">=3.0.1",
    "gulp-streamify": ">=1.0.2",
    "gulp-uglify": ">=1.2.0",
    "gulp-util": ">=3.0.6",
    "reactify": ">=1.1.1",
    "vinyl-source-stream": ">=1.1.0"
  },
  "engines": {
    "node": ">=0.10.0"
  }
}

1 个答案:

答案 0 :(得分:1)

您的npm版本太旧了,它不支持使用^指定的版本范围。您没有使用该语法,但很可能您指定的模块之一是使用该语法的依赖项,因此当它尝试运行npm install gulp-util@'^3.0.0'时会抛出该错误。

如果您通过更新节点或使用npm install -g npm安装最新的npm来更新您的npm,那么您应该能够继续。