Behaviour of npm install --save-dev <folder> and npm install --save-dev <package> is different


(Bayu Aldi Yansyah) #1

Hi guys,

I try running the following command:

npm install --save-dev @nestjs/cli

and npm will install all the dependencies in //node_modules/.bin:

% ls -al node_modules/.bin/
...
lrwxrwxrwx   1 pyk pyk   20 Aug  5 12:49 mkdirp -> ../mkdirp/bin/cmd.js
lrwxrwxrwx   1 pyk pyk   26 Aug  5 12:49 nest -> ../@nestjs/cli/bin/nest.js
lrwxrwxrwx   1 pyk pyk   51 Aug  5 12:49 schematics -> ../@angular-devkit/schematics-cli/bin/schematics.js
lrwxrwxrwx   1 pyk pyk   20 Aug  5 12:49 semver -> ../semver/bin/semver
lrwxrwxrwx   1 pyk pyk   21 Aug  5 12:49 tsc -> ../typescript/bin/tsc
lrwxrwxrwx   1 pyk pyk   22 Aug  5 12:49 ts-node -> ../ts-node/dist/bin.js
lrwxrwxrwx   1 pyk pyk   26 Aug  5 12:49 tsserver -> ../typescript/bin/tsserver

But if I install the package using local folder:

npm install --save-dev ../nest-cli/ 

The //node_modules/.bin are:

% ls -al ./node_modules/.bin/
...
lrwxrwxrwx 1 pyk pyk   26 Aug  5 12:41 nest -> ../@nestjs/cli/bin/nest.js

and it turnsout that all the dependencies are installed in //node_modules/@nestjs/cli/node_modules/.bin.

My question is: Why the behaviour is different?

my expectation is that all packages should be installed in //node_modules instead of //node_modules/@nestjs/cli/node_modules/ (same as npm install --save-dev <package>)


(system) #2

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.