报错1:This package has been marked as private npm ERR! 你的包被设为私有模式了。
npm ERR! code EPRIVATE npm ERR! This package has been marked as private npm ERR! Remove the 'private' field from the package.json to publish it.
原因:你发布的包被标记为私有了,如果你想把它公开就必须删除private字段。该字段就在package.json里面,如下:
解决方案:删掉private,然后重新执行npm publish。
报错2:You do not have permission to publish "vite-project". 没有权限发布这个vite-project包。
npm notice Publishing to https://registry.npmjs.org/ npm ERR! code E403 npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/vite-project - You do not have permission to publish "vite-project". Are you logged in as the correct user? npm ERR! 403 In most cases, you or one of your dependencies are requesting npm ERR! 403 a package version that is forbidden by your security policy, or npm ERR! 403 on a server you do not have access to.
原因:你的包名在npm官网上已被使用。
怎么查看包名?在package.json文件里面的name就是你的包名。
解决方案:可以去官网https://www.npmjs.com/search?q=vite-project搜一下你要发布的报名是否已存在,如果存在了就换一个名字吧,然后再重新执行publish命令。
报错3: [vite] Internal server error: Failed to resolve entry for package "abc-ui". The package may have incorrect main/module/exports specified in its package.json.
[vite]内部服务器错误:解析包“日华云ui”的条目失败。包的package.json中可能指定了不正确的主/模块/导出。
原因:这个报错是因为我的包abc-ui导出的模块有问题,我查看并发现了下package.json文件中的main,module所对应的文件路径是不存在的,是不正确的。
解决方案:把导出包的路径修改正即可
报错3:You cannot publish over the previously published versions: 0.0.0. 您不能发布之前发布的版本:0.0.0。
npm ERR! code E403 npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/abc-ui - You cannot publish over the previously published versions: 0.0.0. npm ERR! 403 In most cases, you or one of your dependencies are requesting npm ERR! 403 a package version that is forbidden by your security policy, or npm ERR! 403 on a server you do not have access to.
原因:刚提交完一个包,想要再提一次,就报错了,因为你再次提交的包的版本号在npm上的包的版本号重复或者相等。
解决方案:修改你的package.json版本号,比如:
把0.0.0改成0.0.1
然后,重新执行publish命令即可。
标签:11,npm,ERR,package,publish,403,报错 From: https://www.cnblogs.com/iuniko/p/18296328