Reputation: 497
I had checked global package minimatch for gulp
$ npm list -g minimatch
+-- [email protected]
| `-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | | `-- [email protected] deduped
| | `-- [email protected]
| `-- [email protected]
| `-- [email protected]
| `-- [email protected]
| +-- [email protected]
| | `-- [email protected] deduped
| `-- [email protected]
Now, i wanted to update all minimatch versions from specific gulp package (all [email protected] and [email protected]) to latest version.
Is their any command in npm that updates my existing package dependencies?
Upvotes: 5
Views: 9751
Reputation:
Here is my solution, you can create symbolic link for minimatch package by using
npm ln
npm link (in package dir)
npm link [<@scope>/]<pkg>[@<version>]
here is link for more explanation https://docs.npmjs.com/cli/link
I think you must not update them manually, because if something comes up wrong, you will have to delete everything and install again. it there are some migration issue disturbing you then try.
npm audit [--json|--parseable]
npm audit fix [--force|--package-lock-only|--dry-run|--production|--only=dev]
here is documentation https://docs.npmjs.com/cli/link
Upvotes: 1
Reputation: 38543
You can't and you shouldn't update subpackages (packages used as dependencies for other packages).
Node modules are designed to contain all dependencies with specified versions inside the node_modules
, in order to avoid problems with new updates. Let's say your [email protected]
introduces some new features, now [email protected]
might stop working, and in turn [email protected]
might stop working as well.
You should either:
Update to a new gulp
version without worrying about minimatch
npm update gulp
or use the latest version of minimatch
directly, using
npm install minimatch
If however you really want to perform the operation for whatever reason, you could try the following ugly hack:
npm install [email protected]
node_modules
folder in this location and copy the minimatch
folderC:\Users\user\AppData\Roaming\npm\node_modules\gulp
on Windows or /usr/lib/node_modules/gulp/
on Linux)minimatch
inside the gulp
installation folder (find . | grep minimatch
)minimatch
folders with the one you just installed in the random locationAt this point gulp
should use the updated minimatch
, although npm list
will still display the old version number.
Again, this is highly not recommended and only provided for the sake of answering the question.
Upvotes: 3