[Solved] npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead. npm ERR! Unexpected token '.'
React JS
Mohit Mozumder
Problem:
While I am trying to use the global command with -g Just trying to install create a new react app with npm install -g command But I am facing the following warning:
npm WARN config global `–global`, `–local` are deprecated. Use `–location=global`
Solution:
Use This Command
npm install --location=global create-react-app
Instead of
npm install -g create-react-app
or
~go to C:\Program Files\nodejs~you have to edit 4 files named npm
, npm.cmd
, npx
, npx.cmd
~open files in vs code
~replace prefix -g
with prefix --location=global
in all four files
~save all (if asked save as admin)
Thank you for reading the article. If you still face any problem feel free to ask us.