npm install npm -g -fnpm install node -g -fnpm config list# global
npm root -g
# local
npm root# global
npm ls --depth 0 -g
# local
npm ls --depth 0# global
npm update -g
# local
npm updatenpm install <package> --save-dev devDependenciesis for developers and not for users.- Packages in
devDependencieswill not be installed when users donpm install <package>. - You cannot install a package globally and add it to
devDependencies
npm uninstall <package> -gnpm uninstall <package> --save-devnpm install @scope/project- A package preceded by an @ symbol such as
@username/packageis a scoped package.- A scope lets you create a package with the same name as a package created by another user or organization, which is conventionally called "Org" in Node.js, without conflict.
- https://docs.npmjs.com/about-scopes
- https://docs.npmjs.com/misc/scope
npm init -ynpx <executable> # e.g. npx tsc foo.tsTip: If you are using npm 5.2 or higher, we recommend using npx to run packages globally. https://docs.npmjs.com/downloading-and-installing-packages-globally
npm init -ynpm install eslint eslint-config-google --save-devcode .
npm init -ynpm install eslint eslint-config-google puppeteer --save-devcode .
--savehas been the default behavior since npm 5.