During my work with the Node.js environment, I faced the issue of version maintenance of Node.js modules. I would like to be sure that all internal Node.js modules are updat
cd C:\Program Files\nodejs
npm i npm@latest
cd C:\Program Files\nodejs\node_modules\npm
npm i %MODULE_NAME%@latest
npm i npm-check@latest -g
npm-check -u
npm-check -u -g
npm update --depth 9999 --dev
npm update --depth 9999 --dev -g
npm cache clear --force
{
"_cmd-update-all-modules": "npm run update-all-modules",
"scripts": {
"create-global-node-modules-folder": "if not exist \"%appdata%\\npm\\node_modules\" mkdir %appdata%\\npm\\node_modules",
"npm-i-g": "npm i npm@latest -g",
"npm-check-i-g": "npm i npm-check@latest -g",
"eslint-i-g": "npm i eslint@latest -g",
"stylelint-i-g": "npm i stylelint@latest -g",
"npm-check-u-l": "npm-check \"C:\\Program Files\\nodejs\\node_modules\\npm\" -y",
"npm-check-u-g": "npm-check \"C:\\Program Files\\nodejs\\node_modules\\npm\" -y -g",
"npm-deep-update-l": "npm update --depth 9999 --dev",
"npm-deep-update-g": "npm update --depth 9999 --dev -g",
"npm-cache-clear": "npm cache clear --force",
"update-all-modules": "npm run create-global-node-modules-folder && npm run npm-i-g && npm run npm-check-i-g && npm run eslint-i-g && npm run stylelint-i-g && npm run npm-check-u-l && npm run npm-check-u-g && npm run npm-deep-update-l && npm run npm-deep-update-g && npm run npm-cache-clear"
}
}
scripts
sectionnpm run update-all-modules
Both of these approaches allow you keeping all Node.js modules updated to the latest version, wherever it is installed locally or globally.
Notes:
npm run update-all-modules
, stored as a hint inside of the _cmd-update-all-modules
property.