我试图安装 phantomjs 以便 进行测试
Twitter Bootstrap .在我在本地安装后,即 npm install phantomjs
,它报告包是无关的。
├─┬ phantomjs@1.9.0-3 extraneous
│ ├── adm-zip@0.2.1
...
npm ERR! extraneous: phantomjs@1.9.0-3 /Users/admin/bootstrap/node_modules/phantomjs
npm ERR! not ok code 0
但是,当 phantomjs 全局安装时,即 npm install phantomjs -g
,它运行良好,即没有报告无关错误。
问题:
- 是不是因为phantomjs not specified in the package.json file ?
- 一般问题:我们可以提供任何包裹吗? phantomjs 安装在全局和本地?
最佳答案
- 是的。 (使用
npm install
重新安装不会再次安装 phantom.js。)(顺便说一句:npm install xxx --save
会自动将 xxx 添加到 package.json) - 是的。本地包版本优于全局包版本。 (尽管您需要对可执行文件进行一些路径处理。)
关于node.js - 本地安装时的无关软件包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16252750/