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

查看:243
本文介绍了无法使用"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 Node v.0.8.6 NPM v.1.1.48 .

I am using: Mac OSX 10.7.4, Node v. 0.8.6, NPM v. 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天全站免登陆