User Tools

Site Tools


programming:javascript:npm

This is an old revision of the document!


NPM

Create a project

npm init

Start project

# install modules from package.json
npm install
# starts the tests defined in 
npm test

Using NPM in browser

Setting the default registry

npm config set registry https://yoururl.com/artifactory/api/npm/npm-all
npm config get registry

The file, where the config is stored is in your home dir and is called '.npmrc'

Making the npm use a special registry for some package namespace is done as following

Opens the '.npmrc' file

npm config edit

And configure the registry e.g. for the `@simpl` pacakges.

Somewhere in `.nprc` add

@simpl:registry=https://code.yourdomain.com/api/v4/packages/npm/
@simpl-labs:registry=https://code.yourdomain.com/api/v4/packages/npm/

If the repository requires authentication - there is some weird syntax allowing to add a token as authentication for a repository, using the `domain` notation <code> @simpl:registry=https://code.yourdomain.com/api/v4/packages/npm/ @simpl-labs:registry=https://code.yourdomain.com/api/v4/packages/npm/ code.yourdomain.com/api/v4/packages/npm/:_authToken=CSC-y-79x5babLxHyeWyE1xJ </code>

programming/javascript/npm.1648063033.txt.gz · Last modified: by skipidar