Shane Jix

npm ERR! 404 Not Found - Scope not found

create:December 06, 2021  update:April 12, 2022  ☕️ 2 min read

同步链接: https://www.shanejix.com/posts/npm ERR! 404 Not Found - Scope not found/

执行 npm publish 时报错

npm notice
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://registry.npmjs.org/@xxx%2fxxx - Scope not found
npm ERR! 404
npm ERR! 404  '@xxx/xxx@0.0.0' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Local\npm-cache\_logs\2021-12-06T14_56_55_018Z-debug.log

如果要使用名称 @scope/package 在 NPM 上发布包,则需要确保 Namespace @scope 在 NPM 上存在。需要创建该命名空间,需要使用 @scope 名称在 NPM 上创建组织

创建该组织后,加入组织并登录

npm login

登录成功后,发布名为 @scope/firstpackage 的包

npm publish --access public

或者,在package.json 中写入

  "publishConfig": {
    "access": "public"
  },

然后执行

npm publish

未设置 publishConfigaccess会报 npm ERR! 402 Payment Required 错误如下:

npm notice
npm ERR! code E402
npm ERR! 402 Payment Required - PUT https://registry.npmjs.org/@xxx%2fxxx - You must sign up
for private packages

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Local\npm-cache\_logs\2021-12-06T15_00_50_580Z-debug.log

references

作者:shanejix 出处:https://www.shanejix.com/posts/npm ERR! 404 Not Found - Scope not found/ 版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。 声明:转载请注明出处!

Edit on GitHubDiscuss on GitHub


Shane Jix

Personal blog by Shane Jix. I explain with words and code.

LinksTools
© 2019 - 2022, Built withGatsby