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 mand in npm that updates my existing package dependencies?
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 mand in npm that updates my existing package dependencies?
Share Improve this question edited Oct 24, 2018 at 15:53 mruanova 7,1156 gold badges40 silver badges58 bronze badges asked Oct 24, 2018 at 10:34 sorabh86sorabh86 4975 silver badges17 bronze badges2 Answers
Reset to default 3You 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:
- install minimatch somewhere in a random location with
npm install [email protected]
- go to the
node_modules
folder in this location and copy theminimatch
folder - find your gulp installation folder (this may depend on your system,
C:\Users\user\AppData\Roaming\npm\node_modules\gulp
on Windows or/usr/lib/node_modules/gulp/
on Linux) - search for
minimatch
inside thegulp
installation folder (find . | grep minimatch
) - replace all the found
minimatch
folders with the one you just installed in the random location
At this point gulp
should use the updated minimatch
, although npm list
will still display the old version number.
Again, this is highly not remended and only provided for the sake of answering the question.
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./cli/link
I think you must not update them manually, because if something es 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./cli/link