Node.js

Node version Management

Absolute path imports for Node.js projects

Jest with absolute path imports for Node.js projects


Global node_modules path

// show global packages location
$ npm root -g


Check updates for node packages

$ npm install -g npm-check-updates
$ ncu -u
$ npm install


Possible additional strong config


packages.json

"engines": {
    "node": ">=12.13.1",
    "npm": ">=6.13.4"
  },


.npmrc

engine-strict=true


// Disable asking for money
$ npm config set fund false --location=global


// Specify registry
$ npm config set registry https://registry.npmjs.org/

$ npm get registry

$ npm config list


// example how to add your repo
$ vi .npmrc

registry=http://mylib.ru:8081/repository/npm-public-repo/


// If yarn will not create node_modules folder create with next content
$ vi .yarnrc.yml
nodeLinker: node-modules