If you use asdf package manager and some global packages are installed or packages are linked Reshim needs to be executed!!!!
$ asdf reshim
To check whether a package is installed
npm ls --global foo
In order to uninstall the globally linked foo package, the following command can be used:
sudo npm rm --global foo
List global packages on Level 0
$ npm list -g -depth=1
Path to the local packages
$ ls /usr/local/lib/node_modules
// link package from package dir
$ npm link
// Install packages from your project dir
$ npm link <package_name>
Scoped packages
// in package.json add scoped name
{
"name": "@mycompany/fast-lib"
// ...
}
// link package from package dir
$ npm link
// Install packages from your project dir
$ npm link <@scope>/<package_name>
// Include package in your project
import { <module> } from '@scope/package_name';
const { <module> } = require('@scope/package_name');
For the first time go into package dir and run
// no scoped package will be public
$ npm publish
// to have public scope packages
$ npm publish --access=public
Update published package
// Update version
$ npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git]
$ npm publish
Inspect package version
# to view a package''s published version
$ npm view <pkg> version
# to inspect current package/dependency versions
$ npm ls