NPM prefix flag does not work as expected on windows NPM prefix flag does not work as expected on windows windows windows

NPM prefix flag does not work as expected on windows


You need to add the same path after the --cwd option.

npm install --prefix <YOUR_PATH> --cwd <YOUR_PATH>


The already accepted answer is correct however it doesn't work on linux.

npm install --prefix your/path --cwd your/path

this works fine on windows, however on linux it gives ENOWORKSPACES: This command does not support workspaces.

To make sure that it works on both just omit the --cwd part like so:

npm install --prefix your/path your/path