npm install和npm install -g的行为不同

时间:2015-06-25 20:30:48

标签: node.js npm gulp

为了使用 gulp.js Windows 7 上构建前端源,我有一个package.json文件,其中定义了node_modules个依赖项:

{
  "name": "custom-repo-name",
  "version": "1.0.0",
  "description": "",
  "main": "gulpfile.js",
  "directories": {
    "doc": "doc"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "gulp-concat": "^2.5.2",
    "gulp-stylus": "^2.0.3",
    "gulp-uglify": "^1.2.0",
    "rimraf": "^2.3.4"
  },
  "devDependencies": {
    "gulp": "^3.9.0",
    "gulp-concat": "^2.5.2",
    "gulp-rev": "^4.0.0",
    "gulp-stylus": "^2.0.3",
    "gulp-uglify": "^1.2.0",
    "gulp-watch": "^4.2.4",
    "rimraf": "^2.3.4"
  }
}

出于某种原因我跑

npm install

依赖项本地安装到.\node_modules文件夹中,gulp命令正常运行。

但是当我跑步时

npm install -g

从输出中可以看出,缺少部分依赖项安装并且运行gulp命令失败,并且依赖项加载失败(例如gulp-uglify.js)。

出了什么问题?

0 个答案:

没有答案