node.js 安装 npm 包失败并显示 404
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47520181/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installing npm package fails with 404
提问by theandroid
Using the command prompt, I am trying to install angular CLI and it fails. I have npm version 5.5.1 and node version v8.9.1. I am trying to install angular cli using the command
使用命令提示符,我尝试安装 angular CLI 但它失败了。我有 npm 版本 5.5.1 和节点版本 v8.9.1。我正在尝试使用以下命令安装 angular cli
npm install -g @angular/cli@latest
npm install -g @angular/cli@latest
and it fails with the error:
它失败并出现错误:
npm ERR! code E404 npm ERR! 404 Not Found: @angular/cli@latest npm ERR! A complete log of this run can be found in:
错误!代码 E404 npm ERR!404 未找到:@angular/cli@latest npm ERR!可以在以下位置找到此运行的完整日志:
I look at the log file and I see its trying to fetch the package from a location that doesn't exist. Not sure from where it gets pulled. How do I fix this location path and install angular cli. Same happens when I try to install typescript or any other npm package. all of them try to install from the location mentioned below and it fails with 404
我查看了日志文件,发现它试图从不存在的位置获取包。不确定它是从哪里拉出来的。如何修复此位置路径并安装 angular cli。当我尝试安装 typescript 或任何其他 npm 包时,也会发生同样的情况。他们都尝试从下面提到的位置安装,但失败并显示 404
8 http fetch GET 404
http://nuget.feed.xyz.corp:8729/npm/FeedNPM/@angular%2fcli 109ms
9 silly fetchPackageMetaData error for @angular/cli@latest 404 Not Found:
@angular/cli@latest
10 verbose stack Error: 404 Not Found: @angular/cli@latest
回答by Matt
回答by Niyongabo
Alternative, another option to avoid 404 npm error
替代方案,避免 404 npm 错误的另一种选择
check if your terminal is in the root directory, if not your npm scripts will not execute because it will not be able to see the package.json
检查您的终端是否在根目录中,如果不是,您的 npm 脚本将不会执行,因为它将无法看到package.json
回答by Alexus
in my case it was .npmrcfile in my project dir, which kept overwriting my global registry url. As soon as I deleted it, I could finally use npm install
在我的情况下,它是.npmrc我的项目目录中的文件,它不断覆盖我的全局注册表 url。删了之后终于可以用了npm install
回答by Ronen
I had same problem with a private package. Need to:
我对私人包裹有同样的问题。需要:
- npm adduser
- npm login
- npm 添加用户
- 登录
回答by Abhay
It was giving the same error for me when I use office network/vpn as they have 'umbrella' DNS security shield. To solve this issue, connect to personal network and type the below commands:
当我使用办公网络/vpn 时,它给了我同样的错误,因为它们具有“伞形”DNS 安全防护。要解决此问题,请连接到个人网络并键入以下命令:
npm config set registry http://registry.npmjs.org
npm install -g @angular/cli
回答by solomon tekie
- change your access level to public. type this in the terminal
- 将您的访问级别更改为公开。在终端输入这个
npm --access=public
- install your angular.
- 安装你的角度。
sudo npm install @ngular/cli
回答by kajal
It is an network error , check your network connection and try to install it again.
这是网络错误,请检查您的网络连接并尝试重新安装。

