本地安装时的无关包 [英] Extraneous Package when Installed Locally
本文介绍了本地安装时的无关包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图安装 phantomjs 以便 make test
推特引导程序.我在本地安装它后,即 npm install phantomjs
,它报告说这个包是无关紧要的.
I was trying to install phantomjs in order to make test
Twitter Bootstrap. After I had installed it locally i.e. npm install phantomjs
, it reported that the package was extraneous.
├─┬ 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
,它工作正常,即没有报告无关的错误.
However, when phantomjs was installed globally i.e. npm install phantomjs -g
, it worked fine i.e. no extraneous error reported.
问题:
- 是不是因为 phantomjs 未在 package.json 文件中指定?
- 一般问题:我们可以提供任何包裹,例如phantomjs 全局安装还是本地安装?
- Is it because phantomjs not specified in the package.json file?
- General question: Can we have any package e.g. phantomjs installed globally and also locally?
推荐答案
- 是的.(使用
npm install
重新安装不会再次安装phantom.js.)(顺便说一句:npm install xxx --save
会自动将xxx 添加到package.json) - 是的.本地包版本优于全局包版本.(尽管您需要对可执行文件进行一些路径处理.)
- Yes. (Re-installing with
npm install
wont install phantom.js again.) (Btw.:npm install xxx --save
will automatically add xxx to the package.json) - Yes. Local package versions are preferred over global ones. (Although you need some path handling for executables.)
这篇关于本地安装时的无关包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文