Node.js npm 安装模块错误

发布于 2024-12-03 15:05:53 字数 1391 浏览 1 评论 0原文

这是我的节点和 npm 版本: 节点-v v0.4.11 npm -v 1.0.27

当我尝试安装模块(例如express)时,出现以下错误:

[root@localhost npm]# npm install express
npm ERR! Error: First argument needs to be a number, array or string.
npm ERR!     at new Buffer (buffer.js:156:15)
npm ERR!     at regRequest (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:82:17)
npm ERR!     at GET (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:211:3)
npm ERR!     at get_ (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:121:3)
npm ERR!     at /usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:46:10
npm ERR!     at cb (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:37:9)
npm ERR! Report this *entire* log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>
npm ERR! 
npm ERR! System Linux 2.6.40.3-0.fc15.i686.PAE
npm ERR! command "node" "/usr/local/bin/npm" "install" "express"
npm ERR! cwd /home/kelvin/Downloads/npm
npm ERR! node -v v0.4.11
npm ERR! npm -v 1.0.27
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/kelvin/Downloads/npm/npm-debug.log
npm not ok

Here is my node and npm version:
node -v v0.4.11
npm -v 1.0.27

When I tried to install a module for example express, I get the following error:

[root@localhost npm]# npm install express
npm ERR! Error: First argument needs to be a number, array or string.
npm ERR!     at new Buffer (buffer.js:156:15)
npm ERR!     at regRequest (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:82:17)
npm ERR!     at GET (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:211:3)
npm ERR!     at get_ (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:121:3)
npm ERR!     at /usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:46:10
npm ERR!     at cb (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:37:9)
npm ERR! Report this *entire* log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>
npm ERR! 
npm ERR! System Linux 2.6.40.3-0.fc15.i686.PAE
npm ERR! command "node" "/usr/local/bin/npm" "install" "express"
npm ERR! cwd /home/kelvin/Downloads/npm
npm ERR! node -v v0.4.11
npm ERR! npm -v 1.0.27
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/kelvin/Downloads/npm/npm-debug.log
npm not ok

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

┼── 2024-12-10 15:05:53

看起来您的 auth 设置为不起作用。不清楚这是怎么发生的——也许检查你的 /home/kelvin/.npmrc 是否有杂散配置?在黑暗中拍摄一点。如果您在 rc.local 中找不到任何内容,我会尝试 npm 邮件列表。

Looks like your auth is set to something that doesn't work. Not clear how that happened -- perhaps check your /home/kelvin/.npmrc for a stray config? Shooting in the dark a bit. I would try npm mailing list if you don't find something in the rc.

魔法唧唧 2024-12-10 15:05:53

https://github.com/isaacs/npm/issues/1372#issuecomment-2036919

isaacs:“git 的主分支通常不稳定。这已经在 HEAD 中修复了。”

git pull后解决,并进行安装。

https://github.com/isaacs/npm/issues/1372#issuecomment-2036919

isaacs: "The master branch from git is often unstable. This is fixed in HEAD already."

Solved after git pull, and make install.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文