somethig wrong with npx Command failed: C:\"Program Files"\nodejs\node.exe

Viewed 1786

my npc always show this error

Command failed: C:\"Program Files"\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js config get cache --parseable
module.js:487

and this only happen on npx

(my npx is from by nodejs offical installer

enter image description here enter image description here

2 Answers

The only way to resolve this is by updating your current npm version.

For Windows,

Run PowerShell as Administrator

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g npm-windows-upgrade
npm-windows-upgrade

Note: Do not run npm i -g npm. Instead use npm-windows-upgrade to update npm going forward. Also if you run the NodeJS installer, it will replace the node version.

For Ubuntu,

sudo npm install npm -g

I had the same issue. Update npm to latest version helped me.

Related