2017-05-06 856 views
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做找的范围?此页面上

回答

2

为了创建一个新公共管理组织,将让你包发布到你的范围完成步骤1,2和3:

https://www.npmjs.com/docs/orgs/getting-started.html

+0

如果你想@npmtestscope,你必须创建一个npmtestscope组织https://www.npmjs.com/docs/orgs/ –

+0

我编辑了答案并接受了它。希望没关系。感谢您的帮助。 – Ole

+0

没问题!谢谢! –