Freecodecamp: How-To-NPM Publish Again

Created on 23 May 2016  路  13Comments  路  Source: freeCodeCamp/freeCodeCamp

Challenge Manage Packages with NPM has an issue.
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

I cannot publish my package a second time in the Publish Again section of how-to-npm on cloud9. It throws an error and tells me that part of the errors involve me adding a user to npm using the adduser command.

I've tried using npm adduser and I've tried going through the tutorial a second time, but every time it get to the Publish Again section it keeps throwing the same error. I've read through several instances but if I try their solutions, it still throws the same error. I've enclosed the code that I see and two screenshots.
cupofjoey:~/workspace/secondtry $ npm publish npm ERR! Linux 4.2.0-c9 npm ERR! argv "/home/ubuntu/.nvm/versions/node/v4.4.3/bin/node" "/home/ubuntu/.nvm/versions/node/v4.4.3/bin/npm" "publish" npm ERR! node v4.4.3 npm ERR! npm v3.9.2 npm ERR! code ENEEDAUTH

npm ERR! need auth auth required for publishing npm ERR! need auth You need to authorize this machine usingnpm adduser``

npm ERR! Please include the following file with any support request: npm ERR! /home/ubuntu/workspace/secondtry/npm-debug.log
cupofjoey:~/workspace/secondtry $ how-to-npm verify module.js:327 throw err; ^

Error: Cannot find module '/home/ubuntu/.config/how-to-npm/registry/@cupofjoey7/secondtry/body.json' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.exports.verify (/home/ubuntu/.nvm/versions/node/v4.4.3/lib/node_modules/how-to-npm/problems/10-publish-again.js:33:14) at Shop.verify (/home/ubuntu/.nvm/versions/node/v4.4.3/lib/node_modules/how-to-npm/node_modules/adventure/index.js:157:15) at Shop.execute (/home/ubuntu/.nvm/versions/node/v4.4.3/lib/node_modules/how-to-npm/node_modules/adventure/index.js:76:14) at Shop.shop.execute (/home/ubuntu/.nvm/versions/node/v4.4.3/lib/node_modules/how-to-npm/index.js:37:45) at Object.<anonymous> (/home/ubuntu/.nvm/versions/node/v4.4.3/lib/node_modules/how-to-npm/index.js:86:8) at Module._compile (module.js:409:26)

screen shot 2016-05-22 at 9 38 29 pm
screen shot 2016-05-22 at 9 38 32 pm

help wanted

Most helpful comment

This worked for me
source : https://github.com/npm/how-to-npm/issues/25
{
It go resolved!!!
1) Switch to Login module (by typing "how-to-npm" on command line)
2) Type "npm adduser" to login
3) Type "npm whoami" to confirm if logged in
4) Switch back to the package at which you are getting error(my case it was Publish Again)
5) Type "npm publish"
6) Done
}

All 13 comments

This is really tricky, i tried it a couple times on a couple different machines (cloud9 included) and i'm getting some variation of the same error. I feel like this could be a bug in npm itself because it shouldn't be acting this way, but I don't want to be so quick to say so. Regardless, i'll file an issue in npm.

Edit: yeah, looks like the issue is with npm. First issue that comes up (been open since February) is exactly this one. https://github.com/npm/how-to-npm/issues/61

@cupofjoey please see the discussion here and see if it solves your problem.

@cupofjoey were you able to get this working?

This worked for me
source : https://github.com/npm/how-to-npm/issues/25
{
It go resolved!!!
1) Switch to Login module (by typing "how-to-npm" on command line)
2) Type "npm adduser" to login
3) Type "npm whoami" to confirm if logged in
4) Switch back to the package at which you are getting error(my case it was Publish Again)
5) Type "npm publish"
6) Done
}

Let's have this work around in a wiki and subsequently link it on the challenge.

Just for the record, I have just experienced this error. Unfortunately, the solution posted here does not work for me. I will add that when I run npm adduser and enter my log-in details that I am unable to run further commands and so running npm whoami is unproductive. I went to npmjs.com and manually logged in and then re-ran npm publish but continued to receive the same error a posted above. For the time being I will have to skip verification of "Publish Again."

Follow up. I resolved the issue in my case by running how-to-npm over and renaming my practice project. Apparently, the original name was too close to a package already published.

@davisec52 so the workaround does work, right?

Well, it worked for my specific case. However, as I work through the lessons, I continue to encounter hangups and glitches. These may very well be due to operator error on my part, but it beats me what they are.

@davisec52 Apologies for the glitches, unfortunately this involves a workshopper "how-to-npm" which is directly not under our control. Since you have managed to overcome some use cases would you help us in modifying the instructions, or the wiki etc. to direct campers facing issues with this?

@raisedadead No apologies necessary. I could certainly update the wiki but with the caveat that because different input seems to generate this error, it is difficult to know when my solution would be appropriate. Right now, I think my best advice would be to skip Nodeschool altogether and find some other means covering the same material.

Closing as stale.

change version in package.json

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jurijuri picture jurijuri  路  3Comments

ar5had picture ar5had  路  3Comments

itsmikewest picture itsmikewest  路  3Comments

DaphnisM picture DaphnisM  路  3Comments

vaibsharma picture vaibsharma  路  3Comments