无法使用“npm install"在 Node.js 中安装任何软件包; [英] Can't install any packages in Node.js using "npm install"

查看:35
本文介绍了无法使用“npm install"在 Node.js 中安装任何软件包;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Node.js 的新手,我正在学习一些教程.出于某种原因,我无法安装任何新的节点模块.

I'm new to Node.js, and I'm going through a few tutorials. For some reason, I can't install any new node modules.

我正在使用:Mac OSX 10.7.4节点 v. 0.8.6NPM 1.1.48 版.

我运行 npm install X 并且总是得到一个

I run npm install X and I always get a

npm ERR! fetch failed https://registry.npmjs.org/-/X
npm ERR! Error: 404 Not Found

当我真正进入 npmjs 注册表时,我可以看到项目页面,但是无论我点击哪个 tarball 链接,它总是一样的:

When I actually go to the npmjs registry, I can see the project page, but no matter which tarball link I hit, it's always the same:

{
    "error": "not_found",
    "reason": "document not found"
}

例如,我尝试通过运行 npm install fs 来安装 fs,我得到:

For example, I tried installing fs by running npm install fs and I get:

npm http GET https://registry.npmjs.org/fs
npm http 200 https://registry.npmjs.org/fs
npm http GET https://registry.npmjs.org/-/fs-0.0.0.tgz
npm http 404 https://registry.npmjs.org/-/fs-0.0.0.tgz
npm ERR! fetch failed https://registry.npmjs.org/-/fs-0.0.0.tgz
npm ERR! Error: 404 Not Found
npm ERR!     at null.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/fetch.js:47:16)
npm ERR!     at EventEmitter.emit (events.js:115:20)
npm ERR!     at WriteStream.flush (fs.js:1514:12)
npm ERR!     at fs.close (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:92:5)
npm ERR!     at Object.oncomplete (fs.js:297:15)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Darwin 11.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "fs"
npm ERR! cwd /Users/comocomo/Documents/workspace/nodeTest
npm ERR! node -v v0.8.6
npm ERR! npm -v 1.1.48
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/comocomo/Documents/workspace/nodeTest/npm-debug.log
npm ERR! not ok code 0

我尝试了 fs、fs-extra、express 和强大的,都给了我相同的 404 响应.我一定有问题,我很确定整个注册表没有损坏.

I tried fs, fs-extra, express, and formidable, all giving me the same 404 response. There must be something wrong on my part, I'm pretty sure the whole registry is not broken.

我使用的是旧注册表吗?我应该在我的配置文件中更改它吗?老实说,我宁愿不开始手动安装,而且我确定这只是一个小配置问题.

Am I using an old registry? Should I change it in my config file? I honestly would rather not start installing things manually, and I'm sure it's just a small configuration issue.

谢谢!

推荐答案

我发现有一个证书过期问题:

I found the there is a certificate expired issue with:

npm set registry https://registry.npmjs.org/

所以我把它设为 http,而不是 https :-

So I made it http, not https :-

npm set registry http://registry.npmjs.org/

到目前为止没有任何问题.

And have no problems so far.

这篇关于无法使用“npm install"在 Node.js 中安装任何软件包;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆