Working on a course that is having me go through a Bash tutorial. I am stuck on the part where the code is asking me to publish my code so far. My instructions are as follows:
What good is a package manager without packages? Not very good. Luckily, that is not a problem for npm, because it's very easy for all npm users to publish their modules and share them with the world. Packages get into the registry by using the `npm publish` command. Try it now. There's not much to it. (Make sure you're still in the right project directory, though. If you publish something by mistake, you can remove it, but there's no guarantee that no one saw it in the meantime.) Then run `how-to-npm verify` when you're done.
My code was:
jsf2008:~/workspace/dev (master) $ npm publish
npm ERR! publish Failed PUT 402
npm ERR! code E402
npm ERR! You must sign up for private packages : @jsf2008/quit
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2017-08-22T14_44_29_746Z-debug.log
jsf2008:~/workspace/dev (master) $
I am quite lost here. I can't even find Error PUT 402 anywhere. Any help would be greatly appreciated.
Lerna is a monorepo manager for JavaScript projects. It helps you take a large codebase and split it into independently deployable packages. Lerna handles every step in the release process — from downloading dependencies, and linking packages together, to testing and publishing updated packages to the NPM registry.
Publishes a package to the registry so that it can be installed by name. By default npm will publish to the public registry. This can be overridden by specifying a different default registry or using a scope in the name, combined with a scope-configured registry (see package. json ).
You're using NPM Scoped packages. They are private by default which requires paying NPM for a private account. If your package is public, you can use the --access=public
flag like this:
npm publish --access=public
First create the org: https://www.npmjs.com/org/create
Then run npm publish --access public
You can solve the problem by adding the following to your package.json
file:
package.json
"publishConfig": {
"access": "public"
}
The publishConfig value manages the visibility of your package. If you define "public" access, then your package can be downloaded by everyone from the npm registry.
If you define "restricted" access, then consumers of your package have to add a .npmrc
file to their own package in order to set an access token:
.npmrc
always-auth=true
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
Note: You don't need the .npmrc
file when you use "public" access.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With