Cli: [BUG] Cannot read property 'resolve' of undefined

Created on 10 Feb 2020  路  5Comments  路  Source: npm/cli

What / Why


When I try to install something I get the following error:

C:\dev\AREPL-vscode>npm install npm@latest -g
npm ERR! Cannot read property 'resolve' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Almenon\AppData\Roaming\npm-cache\_logs\2020-02-09T23_41_41_273Z-debug.log

When


Whenever I try to install something

Where



  • command line on windows 10 desktop machine

How

Current Behavior


error

Steps to Reproduce

  1. download latest LTS version of node on windows via 64-bit MSI installer
  2. skip optional build tools / python 2 deps
  3. finish installing
  4. open command line
  5. Try installing something via npm

Expected Behavior


Install works

Who



  • n/a

References


2020-02-09T23_41_41_273Z-debug.log

Bug

Most helpful comment

Figured out the issue. When we upgraded to newer versions, there must have been changes in paths or something in NPM that don't get cleaned up. Just uninstalling and installing did NOT work. I had to uninstall then delete the nodejs folder. Then everything worked after I re-installed. I did this on 8 build agents that all had the same problem. They all worked.

To Fix:

  1. uninstall node/npm
  2. delete the nodejs folder (in C:Program Files for me)
  3. reinstall node/npm
  4. PROFIT

Same error here:
Windows 10
node v12.16.1
npm v6.13.4

All 5 comments

C:\dev\AREPL-vscode>npm --version
6.13.6

C:\dev\AREPL-vscode>node -v
v13.8.0

same error :(

It didn't work for:

  • _First Configuration_

npm info using [email protected]
npm info using [email protected]

  • _Second Configuration_

npm info using [email protected]
npm info using [email protected]

Same Error:

npm ERR! Cannot read property 'resolve' of undefined

Same error here
Ubuntu 16.04.4 LTS
node v12.15.0
npm v6.13.4

$ npm install npm@latest -g
npm ERR! Cannot read property 'resolve' of undefined

node v11.5.0 does not have this issue.

Figured out the issue. When we upgraded to newer versions, there must have been changes in paths or something in NPM that don't get cleaned up. Just uninstalling and installing did NOT work. I had to uninstall then delete the nodejs folder. Then everything worked after I re-installed. I did this on 8 build agents that all had the same problem. They all worked.

To Fix:

  1. uninstall node/npm
  2. delete the nodejs folder (in C:Program Files for me)
  3. reinstall node/npm
  4. PROFIT

Same error here:
Windows 10
node v12.16.1
npm v6.13.4

Was this page helpful?
0 / 5 - 0 ratings