Getting 404 when attempting to publish new package to NPM

前端 未结 11 1585
礼貌的吻别
礼貌的吻别 2021-01-01 08:42

I just created a new package: https://github.com/supericium/pli

I\'m now trying to publish it to NPM for the first time like this:

    ole@MKI:~/Sand         


        
相关标签:
11条回答
  • 2021-01-01 09:12

    Came across this same error, and my issue was that the package was somehow set to "Read" access only. So I have to go to the NPM and update the package to "Read/Write" access:

    1.

    2.

    0 讨论(0)
  • 2021-01-01 09:17

    Once you successfully publish the package you may experience when you try to npm install:

    npm ERR! code E404
    npm ERR! 404 Not Found: @xxx/yyy@latest
    

    or something similar, regardless if you npm publish was successful. In this case make sure your {main: 'file.js'} in packages.json is there.

    Ideally, you can call it index.js if you wish to leech directly from the package so you don't get things like import * from '@xxx/yyy/file'.

    0 讨论(0)
  • 2021-01-01 09:20

    You could also get this error when you change your password to NPM but you do not logout/login via your CLI. Using npm logout and then npm login worked for me.

    0 讨论(0)
  • 2021-01-01 09:23

    in my case I had to verify the email address. even when npm whoami was telling me I was logged in fine.

    0 讨论(0)
  • 2021-01-01 09:24

    In my case, I was missing the repository field in the package.json of my new package that I was trying to publish.

    "repository": "git://github.com/your-org/your-repo-name.git"
    

    https://docs.npmjs.com/files/package.json#repository

    0 讨论(0)
  • 2021-01-01 09:28

    You need to have registered "supericium" (npm adduser) as a username at the registry and be logged in to publish under that scope.

    • https://docs.npmjs.com/getting-started/publishing-npm-packages
    • https://docs.npmjs.com/getting-started/scoped-packages
    0 讨论(0)
提交回复
热议问题