我是靠谱客的博主 拉长煎蛋,这篇文章主要介绍NPM本地install报错code E404 404Not Found - GET https://registry.npmjs.com/xxxx - Not found,现在分享给大家,希望可以做个参考。

npm install命令既可以下载服务器上的模块,也可以在本地创建自己的模块。

当在本地创建模块的是,需要指定目录,否则install会默认去服务器上下载。
这时候一般会下载失败,报错如下:

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
49 verbose node v16.13.1 50 verbose npm v8.1.2 51 error code E404 52 error 404 Not Found - GET https://registry.npmjs.com/xxxx - Not found 53 error 404 54 error 404 'xxxx@*' is not in this registry. 55 error 404 You should bug the author to publish it (or use the name yourself!) 56 error 404 Note that you can also install from a 57 error 404 tarball, folder, http url, or git url. 58 verbose exit 1

本地创建模块步骤如下(nodejs文件存放在testmd目录下:):

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
> cd testmd > ls testmd.js > npm init --yes #生成package.json文件,这个是创建模块必备文件 Wrote to E:nodejstestmdpackage.json: { "name": "testmd", "version": "1.0.0", "description": "", "main": "testmd.js", "scripts": { "test": "echo "Error: no test specified" && exit 1" }, "keywords": [], "author": "", "license": "ISC" } > ls package.json testmd.js > cd .. #跳到上级目录 > npm install ./testmd added 1 package, and audited 5 packages in 2s found 0 vulnerabilities > ls #打出以上日志表示创建成功。模块安装在node_modules目录下 testmd node_modules

本地创建成功后,还可以将模块发布到服务器上。目前所有的模块都是发布到https://www.npmjs.com/。发布前需要注册和激活一个账户。

激活后在模块目录下执行发布命令即可:

复制代码
1
2
> npm publish

最后

以上就是拉长煎蛋最近收集整理的关于NPM本地install报错code E404 404Not Found - GET https://registry.npmjs.com/xxxx - Not found的全部内容,更多相关NPM本地install报错code内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(85)

评论列表共有 0 条评论

立即
投稿
返回
顶部