在 npm 中发布包的新版本时出错
Error publishing a new version of a package in npm
我正在尝试使用 npm 重新发布一个包。我确实在 package.json
中更新了包版本,但我收到以下错误:
npm ERR! publish Failed PUT 404
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs
\node_modules\npm\bin\npm-cli.js" "publish"
npm ERR! node v0.12.3
npm ERR! npm v2.9.1
npm ERR! code E404
npm ERR! 404 missing : @psychodelicgod/npm
npm ERR! 404
npm ERR! 404 '@psychodelicgod/npm' is not in the npm 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! Please include the following file with any support request:
npm ERR! C:\Users\Michał Szydłowski\npm\npm-debug.log
和我的 debug.log
:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'publish' ]
2 info using npm@2.9.1
3 info using node@v0.12.3
4 verbose node symlink C:\Program Files\nodejs\node.exe
5 verbose publish [ '.' ]
6 silly cache add args [ '.', null ]
7 verbose cache add spec .
8 silly cache add parsed spec { raw: '.',
8 silly cache add scope: null,
8 silly cache add name: null,
8 silly cache add rawSpec: '.',
8 silly cache add spec: 'C:\Users\Michał Szydłowski\npm',
8 silly cache add type: 'directory' }
9 verbose addLocalDirectory C:\Users\Michał Szydłowski\AppData\Roaming\npm-cache\@psychodelicgod\npm.0.2\package.tgz not in flight; packing
10 verbose tar pack [ 'C:\Users\Michał Szydłowski\AppData\Roaming\npm-cache\@psychodelicgod\npm\1.0.2\package.tgz',
10 verbose tar pack 'C:\Users\Michał Szydłowski\npm' ]
11 verbose tarball C:\Users\Michał Szydłowski\AppData\Roaming\npm-cache\@psychodelicgod\npm.0.2\package.tgz
12 verbose folder C:\Users\Michał Szydłowski\npm
13 info prepublish @psychodelicgod/npm@1.0.2
14 verbose addLocalTarball adding from inside cache C:\Users\Michał Szydłowski\AppData\Roaming\npm-cache\@psychodelicgod\npm.0.2\package.tgz
15 silly cache afterAdd @psychodelicgod/npm@1.0.2
16 verbose afterAdd C:\Users\Michał Szydłowski\AppData\Roaming\npm-cache\@psychodelicgod\npm.0.2\package\package.json not in flight; writing
17 verbose afterAdd C:\Users\Michał Szydłowski\AppData\Roaming\npm-cache\@psychodelicgod\npm.0.2\package\package.json written
18 silly publish { name: '@psychodelicgod/npm',
18 silly publish version: '1.0.2',
18 silly publish description: 'd',
18 silly publish main: 'index.js',
18 silly publish scripts: { test: 'node test.js' },
18 silly publish author: '',
18 silly publish license: 'ISC',
18 silly publish dependencies: { '@linclark/pkg': '^1.0.2' },
18 silly publish repository: { type: 'git', url: 'C:\Users\Michał Szydłowski\npm' },
18 silly publish readme: 'Sample description.',
18 silly publish readmeFilename: 'README.md',
18 silly publish _id: '@psychodelicgod/npm@1.0.2',
18 silly publish _shasum: 'b66a8a42e64f0a2b8166ce511629e107d47ab027',
18 silly publish _from: '.' }
19 verbose getPublishConfig undefined
20 silly mapToRegistry name @psychodelicgod/npm
21 silly mapToRegistry scope (from package name) @psychodelicgod
22 verbose mapToRegistry no registry URL found in name for scope @psychodelicgod
23 silly mapToRegistry using default registry
24 silly mapToRegistry registry http://localhost:15443/
25 silly mapToRegistry uri http://localhost:15443/@psychodelicgod%2fnpm
26 verbose publish registryBase http://localhost:15443/
27 silly publish uploading C:\Users\Michał Szydłowski\AppData\Roaming\npm-cache\@psychodelicgod\npm.0.2\package.tgz
28 verbose request uri http://localhost:15443/@psychodelicgod%2fnpm
29 verbose request sending authorization for write operation
30 info attempt registry request try #1 at 13:11:50
31 verbose request id e5c460330af2176f
32 http request PUT http://localhost:15443/@psychodelicgod%2fnpm
33 http 404 http://localhost:15443/@psychodelicgod%2fnpm
34 verbose headers { 'content-type': 'application/json',
34 verbose headers date: 'Fri, 03 Jul 2015 11:11:50 GMT',
34 verbose headers connection: 'keep-alive',
34 verbose headers 'transfer-encoding': 'chunked' }
35 verbose request invalidating C:\Users\Michał Szydłowski\AppData\Roaming\npm-cache\localhost_15443\_40psychodelicgod_252fnpm on PUT
36 error publish Failed PUT 404
37 verbose stack Error: missing : @psychodelicgod/npm
37 verbose stack at CachingRegistryClient.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:247:14)
37 verbose stack at Request._callback (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:170:14)
37 verbose stack at Request.self.callback (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:368:22)
37 verbose stack at Request.emit (events.js:110:17)
37 verbose stack at Request.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:1219:14)
37 verbose stack at Request.emit (events.js:129:20)
37 verbose stack at IncomingMessage.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:1167:12)
37 verbose stack at IncomingMessage.emit (events.js:129:20)
37 verbose stack at _stream_readable.js:908:16
37 verbose stack at process._tickCallback (node.js:355:11)
38 verbose statusCode 404
39 verbose pkgid @psychodelicgod/npm
40 verbose cwd C:\Users\Michał Szydłowski\npm
41 error Windows_NT 6.3.9600
42 error argv "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "publish"
43 error node v0.12.3
44 error npm v2.9.1
45 error code E404
46 error 404 missing : @psychodelicgod/npm
46 error 404
46 error 404 '@psychodelicgod/npm' is not in the npm registry.
46 error 404 You should bug the author to publish it (or use the name yourself!)
46 error 404
46 error 404 Note that you can also install from a
46 error 404 tarball, folder, http url, or git url.
47 verbose exit [ 1, true ]
我在这里尝试了几个类似的答案,但 none 有帮助。有什么想法吗?
#在 npm registry 上发布
您需要创建 npm 用户。可以关注here。
简而言之
npm adduser
npm login
执行 npm config ls
以确保凭据存储在您的客户端上。
然后尝试
npm publish
.
在本地安装或测试打包您的模块
你可以试试
tar -tf $(npm pack)
npm install <path/to/your/package.tgz>
组织范围内 npmjs.org's implementation of the npm server which does not provide useful information when a package fails to publish. If you're using npmjs.org 中存在(截至撰写时)错误,请确保您的用户权限为 read-write
。当然,这看起来很明显,但出现的错误表明正在尝试更新的存储库是 non-existent,或者至少对尝试发布的用户不可见。事实上,用户可能在搜索时能够看到该包,但在尝试发布时却被告知该包不存在。
可能您的 npm 服务器也存在类似问题。
我不知道,安装包过程中你的代码发生了什么。请在此处查看:https://docs.npmjs.com/getting-started/creating-node-modules 了解如何安装包模块。
这些是安装包的简单方法:
Publish your package to npm
Make a new directory outside of your project and cd into it
Run npm install <package>
Create a test.js file which requires the package and calls the method
Run node test.js. The message should be output.
从日志中,我注意到以下异常
36 error publish Failed PUT 404
37 verbose stack Error: missing : @psychodelicgod/npm
您似乎已注销或者您需要 注册 npm adduser “psychodelicgod” 作为 注册处的用户名 并登录以在该范围内发布。请看一下“Working with scoped packages" and "publishing NPM Packages”
我也遇到了同样的问题。
对我来说,电子邮件未经过验证。
您可以登录 npmjs.org 并验证电子邮件。
发布时出现404错误,主要是访问错误。它可能是访问令牌错误或 read-write 错误。请在组织包权限页面上检查您的访问设置。
- 如果您是第一次从本地计算机发布,请使用
npm login
在您的帐户上创建访问令牌。登录后,令牌将自动添加到您的全局 npmrc
文件中,您可以再次尝试发布。
- 如果您尝试更新包并看到 404 错误,请在您的组织设置中为包启用 read-write 权限。
- 如果您使用的是 CI/CD 管道工具,则必须指定
scope
并使用具有 read-write 权限的访问令牌。
我正在尝试使用 npm 重新发布一个包。我确实在 package.json
中更新了包版本,但我收到以下错误:
npm ERR! publish Failed PUT 404
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs
\node_modules\npm\bin\npm-cli.js" "publish"
npm ERR! node v0.12.3
npm ERR! npm v2.9.1
npm ERR! code E404
npm ERR! 404 missing : @psychodelicgod/npm
npm ERR! 404
npm ERR! 404 '@psychodelicgod/npm' is not in the npm 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! Please include the following file with any support request:
npm ERR! C:\Users\Michał Szydłowski\npm\npm-debug.log
和我的 debug.log
:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'publish' ]
2 info using npm@2.9.1
3 info using node@v0.12.3
4 verbose node symlink C:\Program Files\nodejs\node.exe
5 verbose publish [ '.' ]
6 silly cache add args [ '.', null ]
7 verbose cache add spec .
8 silly cache add parsed spec { raw: '.',
8 silly cache add scope: null,
8 silly cache add name: null,
8 silly cache add rawSpec: '.',
8 silly cache add spec: 'C:\Users\Michał Szydłowski\npm',
8 silly cache add type: 'directory' }
9 verbose addLocalDirectory C:\Users\Michał Szydłowski\AppData\Roaming\npm-cache\@psychodelicgod\npm.0.2\package.tgz not in flight; packing
10 verbose tar pack [ 'C:\Users\Michał Szydłowski\AppData\Roaming\npm-cache\@psychodelicgod\npm\1.0.2\package.tgz',
10 verbose tar pack 'C:\Users\Michał Szydłowski\npm' ]
11 verbose tarball C:\Users\Michał Szydłowski\AppData\Roaming\npm-cache\@psychodelicgod\npm.0.2\package.tgz
12 verbose folder C:\Users\Michał Szydłowski\npm
13 info prepublish @psychodelicgod/npm@1.0.2
14 verbose addLocalTarball adding from inside cache C:\Users\Michał Szydłowski\AppData\Roaming\npm-cache\@psychodelicgod\npm.0.2\package.tgz
15 silly cache afterAdd @psychodelicgod/npm@1.0.2
16 verbose afterAdd C:\Users\Michał Szydłowski\AppData\Roaming\npm-cache\@psychodelicgod\npm.0.2\package\package.json not in flight; writing
17 verbose afterAdd C:\Users\Michał Szydłowski\AppData\Roaming\npm-cache\@psychodelicgod\npm.0.2\package\package.json written
18 silly publish { name: '@psychodelicgod/npm',
18 silly publish version: '1.0.2',
18 silly publish description: 'd',
18 silly publish main: 'index.js',
18 silly publish scripts: { test: 'node test.js' },
18 silly publish author: '',
18 silly publish license: 'ISC',
18 silly publish dependencies: { '@linclark/pkg': '^1.0.2' },
18 silly publish repository: { type: 'git', url: 'C:\Users\Michał Szydłowski\npm' },
18 silly publish readme: 'Sample description.',
18 silly publish readmeFilename: 'README.md',
18 silly publish _id: '@psychodelicgod/npm@1.0.2',
18 silly publish _shasum: 'b66a8a42e64f0a2b8166ce511629e107d47ab027',
18 silly publish _from: '.' }
19 verbose getPublishConfig undefined
20 silly mapToRegistry name @psychodelicgod/npm
21 silly mapToRegistry scope (from package name) @psychodelicgod
22 verbose mapToRegistry no registry URL found in name for scope @psychodelicgod
23 silly mapToRegistry using default registry
24 silly mapToRegistry registry http://localhost:15443/
25 silly mapToRegistry uri http://localhost:15443/@psychodelicgod%2fnpm
26 verbose publish registryBase http://localhost:15443/
27 silly publish uploading C:\Users\Michał Szydłowski\AppData\Roaming\npm-cache\@psychodelicgod\npm.0.2\package.tgz
28 verbose request uri http://localhost:15443/@psychodelicgod%2fnpm
29 verbose request sending authorization for write operation
30 info attempt registry request try #1 at 13:11:50
31 verbose request id e5c460330af2176f
32 http request PUT http://localhost:15443/@psychodelicgod%2fnpm
33 http 404 http://localhost:15443/@psychodelicgod%2fnpm
34 verbose headers { 'content-type': 'application/json',
34 verbose headers date: 'Fri, 03 Jul 2015 11:11:50 GMT',
34 verbose headers connection: 'keep-alive',
34 verbose headers 'transfer-encoding': 'chunked' }
35 verbose request invalidating C:\Users\Michał Szydłowski\AppData\Roaming\npm-cache\localhost_15443\_40psychodelicgod_252fnpm on PUT
36 error publish Failed PUT 404
37 verbose stack Error: missing : @psychodelicgod/npm
37 verbose stack at CachingRegistryClient.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:247:14)
37 verbose stack at Request._callback (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:170:14)
37 verbose stack at Request.self.callback (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:368:22)
37 verbose stack at Request.emit (events.js:110:17)
37 verbose stack at Request.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:1219:14)
37 verbose stack at Request.emit (events.js:129:20)
37 verbose stack at IncomingMessage.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:1167:12)
37 verbose stack at IncomingMessage.emit (events.js:129:20)
37 verbose stack at _stream_readable.js:908:16
37 verbose stack at process._tickCallback (node.js:355:11)
38 verbose statusCode 404
39 verbose pkgid @psychodelicgod/npm
40 verbose cwd C:\Users\Michał Szydłowski\npm
41 error Windows_NT 6.3.9600
42 error argv "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "publish"
43 error node v0.12.3
44 error npm v2.9.1
45 error code E404
46 error 404 missing : @psychodelicgod/npm
46 error 404
46 error 404 '@psychodelicgod/npm' is not in the npm registry.
46 error 404 You should bug the author to publish it (or use the name yourself!)
46 error 404
46 error 404 Note that you can also install from a
46 error 404 tarball, folder, http url, or git url.
47 verbose exit [ 1, true ]
我在这里尝试了几个类似的答案,但 none 有帮助。有什么想法吗?
#在 npm registry 上发布
您需要创建 npm 用户。可以关注here。 简而言之
npm adduser
npm login
执行 npm config ls
以确保凭据存储在您的客户端上。
然后尝试
npm publish
.
在本地安装或测试打包您的模块
你可以试试
tar -tf $(npm pack)
npm install <path/to/your/package.tgz>
组织范围内 npmjs.org's implementation of the npm server which does not provide useful information when a package fails to publish. If you're using npmjs.org 中存在(截至撰写时)错误,请确保您的用户权限为 read-write
。当然,这看起来很明显,但出现的错误表明正在尝试更新的存储库是 non-existent,或者至少对尝试发布的用户不可见。事实上,用户可能在搜索时能够看到该包,但在尝试发布时却被告知该包不存在。
可能您的 npm 服务器也存在类似问题。
我不知道,安装包过程中你的代码发生了什么。请在此处查看:https://docs.npmjs.com/getting-started/creating-node-modules 了解如何安装包模块。 这些是安装包的简单方法:
Publish your package to npm
Make a new directory outside of your project and cd into it
Run npm install <package>
Create a test.js file which requires the package and calls the method
Run node test.js. The message should be output.
从日志中,我注意到以下异常
36 error publish Failed PUT 404
37 verbose stack Error: missing : @psychodelicgod/npm
您似乎已注销或者您需要 注册 npm adduser “psychodelicgod” 作为 注册处的用户名 并登录以在该范围内发布。请看一下“Working with scoped packages" and "publishing NPM Packages”
我也遇到了同样的问题。 对我来说,电子邮件未经过验证。 您可以登录 npmjs.org 并验证电子邮件。
发布时出现404错误,主要是访问错误。它可能是访问令牌错误或 read-write 错误。请在组织包权限页面上检查您的访问设置。
- 如果您是第一次从本地计算机发布,请使用
npm login
在您的帐户上创建访问令牌。登录后,令牌将自动添加到您的全局npmrc
文件中,您可以再次尝试发布。 - 如果您尝试更新包并看到 404 错误,请在您的组织设置中为包启用 read-write 权限。
- 如果您使用的是 CI/CD 管道工具,则必须指定
scope
并使用具有 read-write 权限的访问令牌。