Npm publish on Cloud9 doesn't work


#1

I am doing the Manage Packages with npm course and going through the how-to-npm.

Running npm-publish gives the following error:

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

I run npm adduser and login with my npm user details and get the following error. Looks like the login didn’t work but it works fine on the npm site:

npm ERR! 404 missing : -/user/org.couchdb.user:ashnita

Also, npm rm gives the following warning:
npm WARN uninstall not installed in /home/ubuntu/.nvm/versions/node/v4.6.1/lib/node_modules: “test-package”

Any advise?


#2

Maybe NPM on Cloud9 isn’t up to date, have you tried setting up npm locally and publishing from there?


#3

Try creating another workspace. I just tried it and it worked for me - here are the steps I took.

On c9.io, create a new workspace, give it a name and a description, and then select Node.js as your template.

Once the workspace is created,you’ll have a terminal window open. Enter the following command to install the how-to-npm workshop: npm install -g how-to-npm

Enter this command to open the workshop: how-to-npm

Commands entered for each challenge on c9:

Challenge 0 - Install npm

how-to-npm verify
how-to-npm

Challenge 1 - Dev Environment

makedir how-to-npm
cd how-to-npm
npm init (press enter repeatedly for defaults until all questions answered)
how-to-npm verify
how-to-npm

Challenge 2 - Login

npm whoami
npm adduser
foo
bar
foo@bar.com
how-to-npm-verify
how-to-npm

Challenge 3 - Start A Project

npm init --scope=foo (Press enter repeatedly for all defaults)
how-to-npm-verify
how-to-npm

Challenge 4 - Install A Module

npm install @linclark/pkg
how-to-npm-verify
how-to-npm

Challenge 5 - Listing Dependencies

npm ls
how-to-npm verify OK
how-to-npm

Challenge 6 - npm Test

touch test.js
nano package.json (make the edits to the scripts object as instructed)
how-to-npm-verify
how-to-npm

Challenge 7 - Package Niceties

echo "Hello this is a readme file" >> README.md
npm init (Press Enter to accept defaults, except at git repository enter http://foo
how-to-npm-verify
how-to-npm

Challenge 8 - Publish

npm publish
how-to-npm verify
npm view @foo/how-to-npm (npm ERR! ECONNREFUSED)
how-to-npm

Challenge 9 - Version

npm version minor
how-to-npm-verify
how-to-npm

Challenge 10 - Publish Again

npm-publish
how-to-npm-verify
how-to-npm

Challenge 11 - Dist Tag

npm dist-tag add @foo/how-to-npm@1.1.0 beta
how-to-npm-verify
how-to-npm

Challenge 12 - Dist Tag Removal

npm dist-tag rm @foo/how-to-npm beta
npm dist-tag add @foo/how-to-npm@1.0.0 latest
how-to-npm-verify
how-to-npm

Challenge 13 - Outdated

npm outdated
how-to-npm verify @linclark/pkg
how-to-npm-verify
how-to-npm

Challenge 14 - Update

npm update
how-to-npm-verify
how-to-npm

Challenge 15 - Rm

npm rm @linclark/pkg
how-to-npm-verify
how-to-npm

Challenge 16 - Finale

how-to-npm-verify
how-to-npm
Take a screenshot of all challenges as [completed]!


All Done!

image




Cloud 9 how-to-npm not working!
Add dist-tag error with how-to-npm
#4

Hello

I also have the following error after updating npm :frowning: with the exercise 00.
It break down npm and doesnt work anymore if i update it.

Error: Cannot find module 'process-nextick-args’
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/home/ubuntu/.nvm/versions/node/v6.11.2/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:26:23)
at Module._compile (module.js:570:32)
at Object.Module._extensions…js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)


#5

Hey @C3ya, when I tried to publish my npm package the first time, I had picked a name that already existed in npm registry. I was able to publish my package after giving it a unique name. You can search for existing packages here: https://www.npmjs.com.

Just now, I created a new workspace and tried to go through the how-to-npm exercises again and got the same error as you after upgrading the npm version. I guess there is currently a problem with the latest version.

So I created yet another workspace and skipped upgrading the npm version and was able to publish a package. Also, now it seems like the how-to-npm exercise to publish your package only publishes to the “make-believe npm workshop land” :slight_smile:

I hope this helps and good luck for getting through the exercises. Happy to try and help with any other problems too.

Ashnita


#6

Hello @ashB100

Thank you for sharing your experience and contributing my issue too.

As you say, if you dont upgrade npm things look ok with c9. On the other hand how-to-npm is leveraging to make the upgrade. So it pissed me off not to be able to work after upgrade :slight_smile:
So I hope you didnt have any other issues with the obsolete version of the npm.

I tried the same steps with my local computer and everything was allright. I think the problem is with the ubuntu instance at c9.

Thank you for the cooperation
Have a nice day


#7

On c9.io1, create a new workspace, give it a name and a description, and then select Node.js as your template - this is a key tip.