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

Posted hy007x

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了npm安装socket.io时报错的解决方法(npm WARN enoent ENOENT: no such file or directory, open '/usr/local/nodej相关的知识,希望对你有一定的参考价值。

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

技术分享图片

[[email protected] 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/nodej的主要内容,如果未能解决你的问题,请参考以下文章

用npm安装express时报proxy的错误的解决方法

npm无法进行下载以及报错的解决方法

解决CocosCreator 在微信小游戏中使用Socket.io 报错的问题

npm 安装扩展模块时,因缓存报错的问题汇总

TortoiseSVN查看修改时报错的解决方法

详解Vue项目在其他电脑npm run dev运行报错的解决方法