NPM全局包缺少依赖项

时间:2017-10-23 10:45:25

标签: node.js npm gulp node-modules

我在RHEL 7.4上使用nodejs 6.11.4和npm 3.10.10。 我无法安装全局包,因为依赖项未解析。 使用本地项目中使用的包,一切都按预期工作。 例如,当尝试安装gulp时,安装似乎成功(即使使用详细参数):

$ sudo npm install -g gulp-cli
/usr/bin/gulp -> /usr/lib/node_modules/gulp-cli/bin/gulp.js
/usr/lib
└─┬ gulp-cli@1.4.0
  ├── archy@1.0.0
  ├─┬ chalk@1.1.3
  │ ├── ansi-styles@2.2.1
  │ ├── escape-string-regexp@1.0.5
  │ ├─┬ has-ansi@2.0.0
  │ │ └── ansi-regex@2.1.1
  │ ├── strip-ansi@3.0.1
  │ └── supports-color@2.0.0
  ├─┬ copy-props@1.6.0
...

但是在列出全局包时,依赖关系显示为缺失

$ npm list -g
/usr/lib
├─┬ gulp-cli@1.4.0
│ ├── UNMET DEPENDENCY archy@^1.0.0
│ ├── UNMET DEPENDENCY chalk@^1.1.0
│ ├── UNMET DEPENDENCY copy-props@^1.4.1
│ ├── UNMET DEPENDENCY fancy-log@^1.1.0
│ ├── UNMET DEPENDENCY gulplog@^1.0.0
│ ├── UNMET DEPENDENCY interpret@^1.0.0
│ ├── UNMET DEPENDENCY liftoff@^2.3.0
│ ├── UNMET DEPENDENCY lodash.isfunction@^3.0.8
│ ├── UNMET DEPENDENCY lodash.isplainobject@^4.0.4
│ ├── UNMET DEPENDENCY lodash.sortby@^4.5.0
│ ├── UNMET DEPENDENCY matchdep@^1.0.0
│ ├── UNMET DEPENDENCY mute-stdout@^1.0.0
│ ├── UNMET DEPENDENCY pretty-hrtime@^1.0.0
│ ├── UNMET DEPENDENCY semver-greatest-satisfied-range@^1.0.0
│ ├── UNMET DEPENDENCY tildify@^1.0.0
│ ├── UNMET DEPENDENCY v8flags@^2.0.9
│ ├── UNMET DEPENDENCY wreck@^6.3.0
│ └── UNMET DEPENDENCY yargs@^3.28.0
└─┬ npm@3.10.10

即使包裹在那里(例如粉笔):

$ ls -al /usr/lib/node_modules/gulp-cli/node_modules/chalk/
total 28
drwxrwxrwx   2 nobody mjoschko 4096 Oct 23 12:16 .
drwxrwxrwx 133 root   root     4096 Oct 23 12:16 ..
-rwxrwxrwx   1 nobody mjoschko 3154 Mar 29  2016 index.js
-rwxrwxrwx   1 nobody mjoschko 1119 Mar 28  2016 license
-rwxrwxrwx   1 nobody mjoschko 3141 Oct 23 12:16 package.json
-rwxrwxrwx   1 nobody mjoschko 6136 Mar 29  2016 readme.md

0 个答案:

没有答案