npm ERR cb() never called
If you have npm version 5 or above, try this first: $ sudo npm cache verify Otherwise: $ sudo npm cache clean My node and npm versions are: $ node -v v0.10.0 $ npm -v 1.2.14 https://docs.npmjs.com/cli/cache
If you have npm version 5 or above, try this first: $ sudo npm cache verify Otherwise: $ sudo npm cache clean My node and npm versions are: $ node -v v0.10.0 $ npm -v 1.2.14 https://docs.npmjs.com/cli/cache
As noted in another answer, there is now a command for this: nvm now has a command to update npm. It’s nvm install-latest-npm or nvm install –latest-npm. nvm install-latest-npm: Attempt to upgrade to the latest working npm on the current Node.js version. nvm install –latest-npm: After installing, attempt to upgrade to the latest working npm … Read more
The package.json file is used by npm to learn about your node.js project. Use npm init to generate package.json files for you! It comes bundled with npm. Read its documentation here: https://docs.npmjs.com/cli/init Also, there’s an official tool you can use to generate this file programmatically: https://github.com/npm/init-package-json
The following command removes all global npm modules. Note: this does not work on Windows. For a working Windows version, see Ollie Bennett’s Answer. npm ls -gp –depth=0 | awk -F/ ‘/node_modules/ && !/\/npm$/ {print $NF}’ | xargs npm -g rm Here is how it works: npm ls -gp –depth=0 lists all global top level … Read more
Step 1: $ npm cache clean –force Step 2: Delete node_modules by $ rm -rf node_modules (rmdir /S /Q node_modules in windows) folder or delete it manually by going into the directory and right-click > delete / move to trash. If you are not updating your packages you can delete the package-lock.json file too. Step … Read more
I think you’re looking for npm prune npm prune [<name> [<name …]] This command removes “extraneous” packages. If a package name is provided, then only packages matching one of the supplied names are removed. Extraneous packages are packages that are not listed on the parent package’s dependencies list. See the docs: https://docs.npmjs.com/cli/prune
From the npm docs, using a git URL: git://github.com/<user>/<project>.git#<branch> git://github.com/<user>/<project>.git#feature\/<branch> As of NPM version 1.1.65, you can use a shorten github URL: <user>/<project>#<branch> UPDATE 2022 Don’t use git:// protocol for GitHub, as it is not supported npm ERR! The unauthenticated git protocol on port 9418 is no longer supported. npm ERR! Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for … Read more
It stores an exact, versioned dependency tree rather than using starred versioning like package.json itself (e.g. 1.0.*). This means you can guarantee the dependencies for other developers or prod releases, etc. It also has a mechanism to lock the tree but generally will regenerate if package.json changes. From the npm docs: package-lock.json is automatically generated … Read more
Note: Recent npm versions do this automatically when running npm install if package-locks are enabled, so this is not necessary except for removing development packages with the –production flag. Run npm prune to remove modules not listed in package.json. From npm help prune: This command removes “extraneous” packages. If a package name is provided, then … Read more
You can use an npm module called depcheck (requires at least version 10 of Node). Install the module: npm install depcheck -g or yarn global add depcheck Run it and find the unused dependencies: depcheck The good thing about this approach is that you don’t have to remember the find or grep command. To run … Read more