我正在使用how-to-npm
来学习一些基本的npm命令。其中一个练习是向模块添加标签。我正在运行以下命令:npm dist-tag add learnyounode@1.1.0 ["hello"]
,并遇到以下错误:
0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli '/home/ubuntu/.nvm/v0.10.35/bin/npm',
1 verbose cli 'dist-tag',
1 verbose cli 'add',
1 verbose cli 'learnyounode@1.0.0',
1 verbose cli '[hello]' ]
2 info using npm@2.13.0
3 info using node@v0.10.35
4 verbose dist-tag add [hello] to learnyounode@1.0.0
5 silly mapToRegistry name learnyounode
6 silly mapToRegistry using default registry
7 silly mapToRegistry registry http://localhost:15443/
8 silly mapToRegistry uri http://localhost:15443/learnyounode
9 verbose request uri http://localhost:15443/-/package/learnyounode/dist-tags
10 verbose request no auth needed
11 info attempt registry request try #1 at 01:58:44
12 verbose request id 73911a3da82ac8b0
13 http request GET http://localhost:15443/-/package/learnyounode/dist-tags
14 http 404 http://localhost:15443/-/package/learnyounode/dist-tags
15 verbose headers { 'content-type': 'application/json',
15 verbose headers date: 'Mon, 13 Jul 2015 01:58:44 GMT',
15 verbose headers connection: 'keep-alive',
15 verbose headers 'transfer-encoding': 'chunked' }
16 verbose stack Error: missing : -/package/learnyounode/dist-tags
16 verbose stack at CachingRegistryClient.<anonymous> (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:247:14)
16 verbose stack at Request._callback (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:170:14)
16 verbose stack at Request.self.callback (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/npm/node_modules/request/request.js:197:22)
16 verbose stack at Request.emit (events.js:98:17)
16 verbose stack at Request.<anonymous> (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/npm/node_modules/request/request.js:1050:14)
16 verbose stack at Request.emit (events.js:117:20)
16 verbose stack at IncomingMessage.<anonymous> (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/npm/node_modules/request/request.js:996:12)
16 verbose stack at IncomingMessage.emit (events.js:117:20)
16 verbose stack at _stream_readable.js:944:16
16 verbose stack at process._tickCallback (node.js:442:13)
17 verbose statusCode 404
18 verbose cwd /home/ubuntu/workspace/learnyounode
19 error Linux 3.14.13-c9
20 error argv "node" "/home/ubuntu/.nvm/v0.10.35/bin/npm" "dist-tag" "add" "learnyounode@1.0.0" "[hello]"
21 error node v0.10.35
22 error npm v2.13.0
23 error code E404
24 error 404 missing : -/package/learnyounode/dist-tags
25 verbose exit [ 1, true ]
包含我的package.json
文件也许是有益的:
{
"name": "@stevenxl/learnyounode",
"version": "1.1.0",
"description": "Testing",
"main": "baby_steps.js",
"repository": "www.google.com",
"scripts": {
"test": "node test.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"@linclark/pkg": "^1.0.3"
}
}
答案 0 :(得分:4)
这有点晚了,但请确保使用完整的pkg名称并且不要忘记@。与npm dist-tag add @stevenxl/learnyounode@1.1.0 ["hello"]