It can get confusing if you have packages installed globally, and within project folder. Find out where the command originates from when you are using NPM.
See below depending on what you are looking for.
Info about a command that you put in the command line
For e.g you do a -
|
|
.. and you see NPM run and create folder structure. But, you don’t know which this vue
thing.
If you are just looking for a command used from the command line - it is more of the operating system function rather than NPM.
In Windows, do -
|
|
In Linux -
|
|
For example -
|
|
Output -
|
|
I have vue in the above folders on my computer.
Info about command from npm run
If you are looking for the origin of the command used in npm run <blah>
, the easiest way to find out more is to look up the package/app documentation.
You could also do it the hard way. npm run <command>
will start looking for the command in nearest node_modules\.bin
directory, and start spanning out to the parent folders until it resolves or fails.
For e.g. -
- you have installed axios in
t1
folder - you create folder
t11
undert1
- you create folder
t111
undert11
If you do an install or run, npm will go the parent, its parent and its parent until it finds t1
, resolves the command from node_modules and runs it.
You can see which node_modules is used by doing -
|
|
.. or,
|
|
The said script used in npm run
should be in the .bin
.
You can also use the method mentioned in the previous heading to find out where the command file is stored. If the operating system cannot find the command you will see the below message -
|
|
Info about a particular package version
If you are looking for more of the version of the package used by your application and just confused about the version listed in package.json.
You can do a simple -
|
|