change node_modules directory when run command npm install

Viewed 73

i have my folder structure

folder1
   package.json
   src
     files
folder2
   package.json
   src
     files
folder3
   package.json
   src
     files

I would like that when I run the command to install packages, I create a folder with modules not in the same directory as package.json, but, for example, in the same directory above. That is, I want the node_modules folder to be at the same level as the folder1, folder2 and folder3 folders. I tried to use npm config set prefix /mypath but still didn’t figure out how to use it correctly.

0 Answers
Related