2
我想開始發佈npm包到一個範圍。我是否需要註冊爲範圍爲用戶名的用戶?例如,如果我創建一個包這樣的:如何發佈NPM Scoped Packages/NPM scope not found?
[email protected]:~/firstpackage$ npm init
Use `npm install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
name: (firstpackage) @npmtestscope/firstpackage
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /home/ole/deletethis/package.json:
{
"name": "@npmtestscope/firstpackage",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Is this ok? (yes)
[email protected]:~/firstpackage$ touch README.md
[email protected]:~/firstpackage$ npm publish
這是結果:
npm ERR! 404 Scope not found : @npmtestscope/firstpackage
所以我需要什麼,以便NPM做找的範圍?此頁面上
如果你想@npmtestscope,你必須創建一個npmtestscope組織https://www.npmjs.com/docs/orgs/ –
我編輯了答案並接受了它。希望沒關係。感謝您的幫助。 – Ole
沒問題!謝謝! –