码迷,mamicode.com
首页 > Web开发 > 详细

npm安装socket.io时报错的解决方法(npm WARN enoent ENOENT: no such file or directory, open '/usr/local/nodejs/bin/package.json')

时间:2018-08-25 20:02:48      阅读:3859      评论:0      收藏:0      [点我收藏+]

标签:cto   web   this   size   span   sys   config   package   license   

执行 npm install socket.io安装时报错:

技术分享图片

[root@WEB node_modules]# npm install socket.io
npm WARN enoent ENOENT: no such file or directory, open /usr/local/nodejs/bin/package.json npm WARN bin No description npm WARN bin No repository field. npm WARN bin No README data npm WARN bin No license field. npm ERR! path /usr/local/nodejs/bin/node_modules/.staging/socket.io-901b0797/node_modules/socket.io-client npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall rename npm ERR! enoent ENOENT: no such file or directory, rename /usr/local/nodejs/bin/node_modules/.staging/socket.io-901b0797/node_modules/socket.io-client -> /usr/local/nodejs/bin/node_modules/.staging/socket.io-client-cf016aaa npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2018-08-25T09_40_26_701Z-debug.log

解决方法:

命令行中输入:

npm config set registry https://registry.npm.taobao.org
npm config set disturl https://npm.taobao.org/dist

再输入 npm install -g socket.io 即可正确安装。

 

npm安装socket.io时报错的解决方法(npm WARN enoent ENOENT: no such file or directory, open '/usr/local/nodejs/bin/package.json')

标签:cto   web   this   size   span   sys   config   package   license   

原文地址:https://www.cnblogs.com/hy007x/p/9534932.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!