NPM Installs Package Outside Current Directory

后端 未结 3 1499
抹茶落季
抹茶落季 2020-12-10 02:27

I try to install express package using npm from inside /home/iwan/my-project directory:

npm install express

express@3.3.7 ../node_modules/express
├── method         


        
3条回答
  •  一整个雨季
    2020-12-10 02:47

    If the node_modules directory doesn't exist in your current directory, NPM will look for it in the higher directories until it finds it. So, if the parent directory has a node_modules directory, NPM will assume that's where it is to install modules.

    A quick way around this is to create an empty node_modules directory where you want the modules to be placed.

提交回复
热议问题