我对 Web 开发等还很陌生,但我正在尝试为一个项目开发一个非常小的 RESTful Web 应用程序;我想我会尝试以正确的方式去做,所以我开始遵循一些教程等等。长话短说,当我在尝试发布时遇到问题时,我正在学习一个名为 how-to-npm 的教程。我不太明白错误消息,因为逻辑对我来说似乎有点落后。 (它说它在注册表中找不到该名称,[我认为]它正在按预期工作,因为我仍在尝试发布它,但我认为可能发生的情况是它无法发布我的项目,然后在代码中检查是否已发布,发现确实未发布)
请查找下面的 npm-debug.log 数据 - 如有任何帮助,我们将不胜感激。 (注意:test.js只是一个空文件)
0 info it worked if it ends with ok
1 verbose cli [ '/home/omar/.nvm/versions/node/v5.7.0/bin/node',
1 verbose cli '/home/omar/.nvm/versions/node/v5.7.0/bin/npm',
1 verbose cli 'publish' ]
2 info using <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3d534d507d0e130a130e" rel="noreferrer noopener nofollow">[email protected]</a>
3 info using <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9ef0f1fafbdee8abb0a9b0ae" rel="noreferrer noopener nofollow">[email protected]</a>
4 verbose publish [ '.' ]
5 silly cache add args [ '.', null ]
6 verbose cache add spec .
7 silly cache add parsed spec Result {
7 silly cache add raw: '.',
7 silly cache add scope: null,
7 silly cache add name: null,
7 silly cache add rawSpec: '.',
7 silly cache add spec: '/home/omar/Desktop/Projects/how-to-npm',
7 silly cache add type: 'directory' }
8 verbose addLocalDirectory /home/omar/.npm/@linkclark/pkg/1.0.0/package.tgz not in flight; packing
9 verbose correctMkdir /home/omar/.npm correctMkdir not in flight; initializing
10 info lifecycle @linkclark/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4e3e25290e7f607e607e" rel="noreferrer noopener nofollow">[email protected]</a>~prepublish: @linkclark/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1363787453223d233d23" rel="noreferrer noopener nofollow">[email protected]</a>
11 silly lifecycle @linkclark/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c6b6ada186f7e8f6e8f6" rel="noreferrer noopener nofollow">[email protected]</a>~prepublish: no script for prepublish, continuing
12 verbose tar pack [ '/home/omar/.npm/@linkclark/pkg/1.0.0/package.tgz',
12 verbose tar pack '/home/omar/Desktop/Projects/how-to-npm' ]
13 verbose tarball /home/omar/.npm/@linkclark/pkg/1.0.0/package.tgz
14 verbose folder /home/omar/Desktop/Projects/how-to-npm
15 verbose addLocalTarball adding from inside cache /home/omar/.npm/@linkclark/pkg/1.0.0/package.tgz
16 verbose correctMkdir /home/omar/.npm correctMkdir not in flight; initializing
17 silly cache afterAdd @linkclark/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="05756e6245342b352b35" rel="noreferrer noopener nofollow">[email protected]</a>
18 verbose afterAdd /home/omar/.npm/@linkclark/pkg/1.0.0/package/package.json not in flight; writing
19 verbose correctMkdir /home/omar/.npm correctMkdir not in flight; initializing
20 verbose afterAdd /home/omar/.npm/@linkclark/pkg/1.0.0/package/package.json written
21 silly publish { name: '@linkclark/pkg',
21 silly publish version: '1.0.0',
21 silly publish description: 'nu\'un',
21 silly publish main: 'index.js',
21 silly publish scripts: { test: 'node test.js' },
21 silly publish repository:
21 silly publish { type: 'git',
21 silly publish url: 'git+https://github.com/OmarAYousry/how-to-npm.git' },
21 silly publish keywords: [ 'how' ],
21 silly publish author: { name: 'Omar' },
21 silly publish license: 'ISC',
21 silly publish dependencies: { '@linclark/pkg': '^1.0.2' },
21 silly publish readme: 'This is the repo for my how-to-npm tutorial\n\nnothing else\n',
21 silly publish readmeFilename: 'README.md',
21 silly publish gitHead: '8ceb774a26300db413e522984b776246d8747372',
21 silly publish bugs: { url: 'https://github.com/OmarAYousry/how-to-npm/issues' },
21 silly publish homepage: 'https://github.com/OmarAYousry/how-to-npm#readme',
21 silly publish _id: '@linkclark/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="74041f1334455a445a44" rel="noreferrer noopener nofollow">[email protected]</a>',
21 silly publish _shasum: '47a5cba321a9be5e4e0a904623be0148619980e8',
21 silly publish _from: '.' }
22 verbose getPublishConfig undefined
23 silly mapToRegistry name @linkclark/pkg
24 silly mapToRegistry scope (from package name) @linkclark
25 verbose mapToRegistry no registry URL found in name for scope @linkclark
26 silly mapToRegistry using default registry
27 silly mapToRegistry registry http://localhost:15443/
28 silly mapToRegistry uri http://localhost:15443/@linkclark%2fpkg
29 verbose publish registryBase http://localhost:15443/
30 silly publish uploading /home/omar/.npm/@linkclark/pkg/1.0.0/package.tgz
31 verbose request uri http://localhost:15443/@linkclark%2fpkg
32 verbose request sending authorization for write operation
33 info attempt registry request try #1 at 9:44:12 AM
34 verbose request id a61f260c4fe4949e
35 http request PUT http://localhost:15443/@linkclark%2fpkg
36 http 404 http://localhost:15443/@linkclark%2fpkg
37 verbose headers { 'content-type': 'application/json',
37 verbose headers date: 'Sat, 27 Feb 2016 07:44:12 GMT',
37 verbose headers connection: 'keep-alive',
37 verbose headers 'content-length': '19' }
38 verbose request invalidating /home/omar/.npm/localhost_15443/_40linkclark_252fpkg on PUT
39 error publish Failed PUT 404
40 verbose stack Error: missing : @linkclark/pkg
40 verbose stack at makeError (/home/omar/.nvm/versions/node/v5.7.0/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:264:12)
40 verbose stack at CachingRegistryClient.<anonymous> (/home/omar/.nvm/versions/node/v5.7.0/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:252:14)
40 verbose stack at Request._callback (/home/omar/.nvm/versions/node/v5.7.0/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:172:14)
40 verbose stack at Request.self.callback (/home/omar/.nvm/versions/node/v5.7.0/lib/node_modules/npm/node_modules/request/request.js:199:22)
40 verbose stack at emitTwo (events.js:100:13)
40 verbose stack at Request.emit (events.js:185:7)
40 verbose stack at Request.<anonymous> (/home/omar/.nvm/versions/node/v5.7.0/lib/node_modules/npm/node_modules/request/request.js:1036:10)
40 verbose stack at emitOne (events.js:95:20)
40 verbose stack at Request.emit (events.js:182:7)
40 verbose stack at IncomingMessage.<anonymous> (/home/omar/.nvm/versions/node/v5.7.0/lib/node_modules/npm/node_modules/request/request.js:963:12)
41 verbose statusCode 404
42 verbose pkgid @linkclark/pkg
43 verbose cwd /home/omar/Desktop/Projects/how-to-npm
44 error Linux 3.19.0-51-generic
45 error argv "/home/omar/.nvm/versions/node/v5.7.0/bin/node" "/home/omar/.nvm/versions/node/v5.7.0/bin/npm" "publish"
46 error node v5.7.0
47 error npm v3.7.3
48 error code E404
49 error 404 missing : @linkclark/pkg
50 error 404
51 error 404 '@linkclark/pkg' is not in the npm registry.
52 error 404 You should bug the author to publish it (or use the name yourself!)
53 error 404 Note that you can also install from a
54 error 404 tarball, folder, http url, or git url.
55 verbose exit [ 1, true ]
最佳答案
我建议不要仅仅为了遵循教程并使用空文件而发布到 NPM。 原因是你会用不工作的软件(因为它只是一个空文件)污染它,此外,引用 NPM 文档:
一旦使用给定名称和版本发布包,该特定名称和版本组合就永远不能再次使用,即使使用 npm-unpublish 删除它也是如此
关于json - 我的 NPM 项目不会发布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35667241/