Getting 404 when attempting to publish new package to NPM

80,470

Solution 1

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

Solution 2

It's solved by npm login in my case, the error message is misleading

Solution 3

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.

enter image description here

2.

enter image description here

Solution 4

Nothing worked for me, except logging in again:

npm login

Hope this helps me or someone else in the future!

Solution 5

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.

Share:
80,470

Related videos on Youtube

Ole
Author by

Ole

Updated on February 03, 2022

Comments

  • Ole
    Ole over 2 years

    I just created a new package.

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

        ole@MKI:~/Sandbox/pli$ npm publish  --access public
        npm ERR! publish Failed PUT 404
        npm ERR! Linux 3.13.0-93-generic
        npm ERR! argv "/home/ole/.nvm/versions/v6.4.0/bin/node" "/home/ole/.nvm/versions/v6.4.0/bin/npm" "publish" "--access" "public"
        npm ERR! node v6.4.0
        npm ERR! npm  v3.10.3
        npm ERR! code E404
    
        npm ERR! 404 Not found : @supericium/pli
        npm ERR! 404 
        npm ERR! 404  '@supericium/pli' is not in the npm registry.
        npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
        npm ERR! 404 
        npm ERR! 404 Note that you can also install from a
        npm ERR! 404 tarball, folder, http url, or git url.
    
        npm ERR! Please include the following file with any support request:
        npm ERR!     /home/ole/Sandbox/pli/npm-debug.log
    

    I tried updating both NodeJS and NPM to make sure that I have the latest version, which are:

    ole@MKI:~/Sandbox/pli$ node --version
    v6.4.0
    ole@MKI:~/Sandbox/pli$ npm --version
    3.10.3
    

    Thoughts?

    • Steve
      Steve over 2 years
      Yes, it makes no sense. Can't create a package because it doesn't exist. None of these answers solve the problem.
    • Oleg Valter is with Ukraine
      Oleg Valter is with Ukraine over 2 years
      @Distortum Try running publish in verbose mode - in a very frustrating way, in normal mode many issues end up as 404 while the real reason may be 403 because of a variety of issues. Usually running the verbose mode makes the issue apparent.
  • Jacob Poul Richardt
    Jacob Poul Richardt about 5 years
    Spent so much time trying to fix it before I found this. Thanks ;)
  • Will Strohl
    Will Strohl almost 4 years
    Ugh... This was it for me. There is nothing telling you you're not logged in.
  • DenisKolodin
    DenisKolodin over 3 years
    It works... but when I published my package to npm their website stopped to work and shows me error loading page :)))
  • AndyO
    AndyO about 3 years
    Sidenote: The problem isn't the client but that the npm registry sends 404. I've been told that when you e.g. use verdaccio as a proxy, it sends 401 if the login info is incorrect. Which makes the client show the expected "you need to log in" message.
  • Derek Hubbard
    Derek Hubbard about 3 years
    How did you verify the email address? By executing npm config ls or something different?
  • jthegedus
    jthegedus almost 3 years
    The default in the docs lists .org as the correct URL - docs.npmjs.com/cli/v7/using-npm/config#registry
  • Steve
    Steve over 2 years
    It doesn't work.
  • dearwish
    dearwish over 2 years
    It worked, thank you
  • Ben Racicot
    Ben Racicot over 2 years
    Whoa! This was the answer for me. Despite being authenticated via command line I had to re-add my user and retry the publish. Really bad CLI experience on that one.
  • Conaclos
    Conaclos over 2 years
    NPM error messages are still confusing... Thanks for the hint, it solved my problem :)