npm install 慢报错

--一步,二步,三步,N步,二行脚印
张映 发表于
分类目录:
标签:, , , , ,
用npm安装phantomjs的时候,报以下错误:
events.js:72
// Unhandled 'error' event
Error: read ECONNRESET
..........省略............
网上说的原因有很多,经测试,是因为下载不到文件而报出的错误。如果能连网的话,很可能就是墙内,墙外的原因了。
解决办法:
npm config set registry=http://registry.npmjs.org
npm config set proxy=http://127.0.0.1:8087
1,将下载源的地址,由https://registry.npmjs.org改成http://registry.npmjs.org
2,http://127.0.0.1:8087是本地goagent的代理
转载请注明作者:海底苍鹰地址:2679人阅读
要安装npm首先要安装git,地址
安装完了,找到&Git Bash&,点击运行就出现了一个命令窗口.和linux下一样,(估计git是个linux模拟器).
按照github上的提示在命令行输入4个命令
$ git config --system http.sslcainfo /bin/curl-ca-bundle.crt
$ git clone --recursive git:///isaacs/npm.git
$ node cli.js install npm -gf
等待...git就会联网把npm下载到nodejs的目录中.并且安装配置好.
运行cmd,输入npm如果没有提示无法找到命令之类的提示说明npm安装好了.
github上提示要在系统的环境变量Path中加入nodejs所在的路径.不过我装完了nodejs以后发现这个路径已经有了
如果没有就请加上,方便运行npm
现在开始安装nodejs的express模块,输入命令
& npm install express
npm同样会自动联网下载需要的文件,并且配置好.所以需要等待一段时间,视网速而定.
如果最后没有出现&npm not ok&的字样,说明安装成功.
我安装模块是出现了1种错误.
npm&ERR!&cb() never called!
npm not ok
谷歌之,没看明白是啥意思。
咋解决,很神奇!使用命令
&npm install -g express
提示错误同样,但是去nodejs/node_modules/目录下发现除了npm已经多了express,
可以使用。但是哪里错误还不清楚。
版权声明:本文为博主原创文章,未经博主允许不得转载。
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:1451563次
积分:21332
积分:21332
排名:第148名
原创:581篇
转载:736篇
评论:337条
(3)(2)(8)(5)(2)(4)(1)(1)(1)(26)(63)(63)(49)(35)(8)(16)(13)(17)(34)(46)(18)(32)(45)(13)(10)(66)(88)(57)(34)(34)(27)(23)(11)(18)(11)(84)(21)(28)(70)(6)(5)(17)(37)(12)(23)(14)(2)(8)(1)(10)(15)(23)(3)(19)(19)(7)(4)(1)(5)(2)收藏,2.4k 浏览
问题对人有帮助,内容完整,我也想知道答案
问题没有实际价值,缺少关键内容,没有改进余地
想在本机上装Bootstrap的源码,需要安装Grunt。
按照官网的表述,在执行npm install时,出现了很多报错。
希望有人指点一下是什么原因?还要装其他的环境吗?
以下为命令行:
F:\Office software2\bootstrap-3.2.0&npm install
npm WARN deprecated grunt-jscs-checker@0.6.2: Package was renamed to 'grunt-jscs
npm WARN package.json github-url-from-git@1.1.1 No repository field.
phantomjs@1.9.10 install F:\Office software2\bootstrap-3.2.0\node_modules\grun
t-contrib-qunit\node_modules\grunt-lib-phantomjs\node_modules\phantomjs
node install.js
Downloading
Saving to C:\Users\博闻\AppData\Local\Temp\phantomjs\phantomjs-1.9.7-windows.zip
Receiving...
Error making request.
Error: connect ETIMEDOUT
at errnoException (net.js:904:11)
at Object.afterConnect [as oncomplete] (net.js:895:19)
Please report this full log at
npm ERR! phantomjs@1.9.10 install: node install.js
npm ERR! Exit status 1
npm ERR! Failed at the phantomjs@1.9.10 install script.
npm ERR! This is most likely a problem with the phantomjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
node install.js
npm ERR! You can get their info via:
npm owner ls phantomjs
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "F:\Office software2\Node.js\\node.exe" "F:\Office softwar
e2\Node.js\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! cwd F:\Office software2\bootstrap-3.2.0
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
答案对人有帮助,有参考价值
答案没帮助,是错误的答案,答非所问
单纯的就是phantomjs安装出错,这个错误我经常遇到(能遇到用yeoman的同学真是很开心的事情)
你注意它这两句log:
Downloading
Saving to C:\Users\博闻\AppData\Local\Temp\phantomjs\phantomjs-1.9.7-windows.zip
Receiving...
正常的安装过程这里是会出现下载的百分比的,然后一点一点向前推进到100%,如果直接出Err就是这里下载失败
处理这个问题很简单,手动去下载phantomjs-1.9.7-windows.zip(关于如何手动下载,这个百度或者Google一下)
然后把它手动的放到C:\Users\博闻\AppData\Local\Temp\phantomjs\目录下,然后你在运行一下npm install就可以了
其实说个题外话,phantomjs多用在测试上的,对你build或者serve应该是没有妨碍的,即使出错的也可以使用这两个功能
不要错过该问题的后续解决方案
如果你没找到答案,记得登录关注哦,大家会尽全力帮你解决的 ^___^
分享到微博?
关闭理由:
删除理由:
忽略理由:
推广(招聘、广告、SEO 等)方面的内容
与已有问题重复(请编辑该提问指向已有相同问题)
答非所问,不符合答题要求
宜作评论而非答案
带有人身攻击、辱骂、仇恨等违反条款的内容
无法获得确切结果的问题
非开发直接相关的问题
非技术提问的讨论型问题
其他原因(请补充说明)
举报理由:
推广(招聘、广告、SEO 等)方面的内容
带有人身攻击、辱骂、仇恨等违反条款的内容
与已有问题重复(请编辑该提问指向已有相同问题)
内容质量差,或不适合在本网站出现
答非所问,不符合答题要求
其他原因(请补充说明)
补充说明:Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free.
I've been trying to run an npm install on my package.json file, but I'm having a lot of trouble.
It keeps saying "Error:
Attempt to unlock XXX, which hasn't been locked" on all my dependences.
Here's one of them:
Error: Attempt to unlock tbd@~0.6.4, which hasn't been locked
at unlock (/usr/local/lib/node_modules/npm/lib/cache.js:1304:11)
at cb (/usr/local/lib/node_modules/npm/lib/cache.js:646:5)
at /usr/local/lib/node_modules/npm/lib/cache.js:655:20
at /usr/local/lib/node_modules/npm/lib/cache.js:1290:7
at /usr/local/lib/node_modules/npm/node_modules/lockfile/lockfile.js:167:38
at OpenReq.Req.done (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:144:5)
at OpenReq.done (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:64:22)
at Object.oncomplete (fs.js:107:15)
If I try to run it as sudo, it seems to get further and start installing some packages, but some new errors popup instead:
& chokidar@0.8.1 postinstall /Users/tkirchner/Documents/Projects/mm-datatable/node_modules/karma/node_modules/chokidar
& node setup-deps.js
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
node.js:811
var cwd = process.cwd();
Error: EACCES, permission denied
at Function.startup.resolveArgv0 (node.js:811:23)
at startup (node.js:58:13)
at node.js:902:3
npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/Users/tkirchner/Documents/Projects/mm-datatable/node_modules/karma/node_modules/q'
npm ERR! error rolling back
karma@0.10.9 { [Error: ENOTEMPTY, rmdir '/Users/tkirchner/Documents/Projects/mm-datatable/node_modules/karma/node_modules/q']
npm ERR! error rolling back
errno: 53,
npm ERR! error rolling back
code: 'ENOTEMPTY',
npm ERR! error rolling back
path: '/Users/tkirchner/Documents/Projects/mm-datatable/node_modules/karma/node_modules/q' }
npm ERR! Error: ENOENT, chown '/Users/tkirchner/Documents/Projects/mm-datatable/node_modules/karma/node_modules/socket.io/lib/socket.io.js'
I recently updated my node and npm installations.
So maybe that has something to do with it.
Also, most of my development has been at the office and today I'm working over VPN, so maybe that has something to do with it too.
Any ideas?
2,52641424
As per photusenigma at:
Run these commands in a terminal window (note - DON'T replace the $USER part...thats a linux command to get your user!):
sudo chown -R $USER ~/.npm
sudo chown -R $USER /usr/local/lib/node_modules
...and...if you're on a mac (like I am), and still see errors after running these commands, then run this last one and you should be good. (Recommend you try testing before you do this one. I don't like changing the permissions on the ENTIRE /usr/local directory unless it really seems necessary!)
sudo chown -R $USER /usr/local
I worked with a co-worker this afternoon and figured out what the problem was.
My ".npm" folder in my home directory was owned by the root user instead of myself.
I'm not sure what happened to cause that.
Maybe I installed node or npm as the root admin at one point.
In any case I just ran sudo chown -R [username] .npm and I was finally able to run npm install commands from my projects again!
14.8k117886
2,52641424
In my case the issue was invoking npm with a user that does not have a HOME directory, so for example the following command would fail:
sudo -u someUser npm install
The solution is to provide a HOME directory, where someUser has write access:
sudo -u someUser HOME=/some/directory npm install
Had the same issue and fixed it by changing the persmissions as per the accepted answer:
sudo chown -R $USER ~/.npm
However, the second command should be avoided as it downgrades the permissions of a system resource (sudo chown -R $USER /usr/local/lib/node_modules). Not a good idea.
For the record: "usr" in /usr/local stands for Unix System Resources.
None of this worked for me.
I had to run literally as root by doing the following:
sudo npm install forever -g
Then the package installed on Linux Ubuntu 14.04.
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enablednodejs&npm&安装报错&无法安装&behind&a&proxy
npm ERR! Error: connect ECONNREFUSED
at errnoException (net.js:878:11)
at Object.afterConnect [as oncomplete] (net.js:869:19)
npm ERR!& { [Error: connect ECONNREFUSED]
npm ERR!&& code:
'ECONNREFUSED',
npm ERR!&& errno:
'ECONNREFUSED',
npm ERR!&& syscall: 'connect'
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly.& See:
'npm help config'
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe"
"C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
"nodemailer"
npm ERR! cwd C:\Users\yy
npm ERR! node -v v0.10.2
npm ERR! npm -v 1.2.15
npm ERR! syscall connect
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! stack Error: connect ECONNREFUSED
at errnoException (net.js:878:11)
at Object.afterConnect [as oncomplete] (net.js:869:19)
npm ERR! Additional logging details can be found in:
C:\Users\yy\npm-debug.log
npm ERR! not ok code 0
<img ALT=""
TITLE="nodejs&npm&安装报错&无法安装&behind&a&proxy" />
这条错误,你的代理怎么怎么地,万恶了很久,解决其实很简单啊,npm可能是默认的proxy
http://127.0.0.1.8087
$ npm config set proxy null
把代理去掉就行了
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。

我要回帖

更多关于 npm install 慢 的文章

 

随机推荐