2021年11月8日 星期一

Cannot install npm modules "cross-env"

Problems

Installing npm module "cross-env" states the following error

npm error on every command: EEXIST: file already exists, mkdir 'c:\users\user\appdata\Roaming\npm'

Troubleshoot

  1. Try re-installing the module -> no luck
  2. Try installing with "npm install --force --save-dev cross-env" -> no luck
  3. Try removing npm cache -> no luck
Solutions
Turns out I have put the npm start scripts before actually install the module, which is the cause of the error, DO NOT update the script with the command "cross-env" before installing it.

References