help icon indicating copy to clipboard operation
help copied to clipboard

Cannot read property 'resolve' of undefined

Open jinggqu opened this issue 7 years ago • 25 comments

node -v

v10.16.0

npm -v

6.9.0

commad

npm install -g hexo-cli from https://hexo.io/docs/

platform

windows 1903 18362.145 with Windows PowerShell

log

0 info it worked if it ends with ok
1 verbose cli [ 'D:\\Software\\nodejs\\node.exe',
1 verbose cli   'D:\\Software\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   'hexo-cli' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 63fbe32fbd21f92e
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for hexo-cli@latest Cannot read property 'resolve' of undefined
8 timing stage:rollbackFailedOptional Completed in 1ms
9 timing stage:runTopLevelLifecycles Completed in 32ms
10 verbose stack TypeError: Cannot read property 'resolve' of undefined
10 verbose stack     at regFetch (D:\Software\nodejs\node_modules\npm\node_modules\npm-registry-fetch\index.js:76:23)
10 verbose stack     at fetchPackument (D:\Software\nodejs\node_modules\npm\node_modules\pacote\lib\fetchers\registry\packument.js:42:10)
10 verbose stack     at packument (D:\Software\nodejs\node_modules\npm\node_modules\pacote\lib\fetchers\registry\packument.js:20:10)
10 verbose stack     at getManifest (D:\Software\nodejs\node_modules\npm\node_modules\pacote\lib\fetchers\registry\manifest.js:22:10)
10 verbose stack     at manifest (D:\Software\nodejs\node_modules\npm\node_modules\pacote\lib\fetchers\registry\manifest.js:13:10)
10 verbose stack     at Object.manifest (D:\Software\nodejs\node_modules\npm\node_modules\pacote\lib\fetchers\registry\index.js:17:12)
10 verbose stack     at Object.Fetcher#manifest [as manifest] (D:\Software\nodejs\node_modules\npm\node_modules\genfun\lib\genfun.js:15:38)
10 verbose stack     at manifest (D:\Software\nodejs\node_modules\npm\node_modules\pacote\lib\fetch.js:23:18)
10 verbose stack     at pinflight (D:\Software\nodejs\node_modules\npm\node_modules\pacote\manifest.js:24:12)
10 verbose stack     at D:\Software\nodejs\node_modules\npm\node_modules\promise-inflight\inflight.js:29:24
10 verbose stack     at Promise._execute (D:\Software\nodejs\node_modules\npm\node_modules\bluebird\js\release\debuggability.js:313:9)
10 verbose stack     at Promise._resolveFromExecutor (D:\Software\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:483:18)
10 verbose stack     at new Promise (D:\Software\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:79:10)
10 verbose stack     at _inflight (D:\Software\nodejs\node_modules\npm\node_modules\promise-inflight\inflight.js:28:25)
10 verbose stack     at D:\Software\nodejs\node_modules\npm\node_modules\promise-inflight\inflight.js:22:14
10 verbose stack     at tryCatcher (D:\Software\nodejs\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
11 verbose cwd D:\Blog
12 verbose Windows_NT 10.0.18362
13 verbose argv "D:\\Software\\nodejs\\node.exe" "D:\\Software\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "hexo-cli"
14 verbose node v10.16.0
15 verbose npm  v6.9.0
16 error Cannot read property 'resolve' of undefined
17 verbose exit [ 1, true ]

jinggqu avatar Jun 01 '19 15:06 jinggqu

Same issue with node 10.16.0 to 12.4.0 on MacOS(installed node and npm through n latest). Works fine with 10.6.0 though!

ganapativs avatar Jun 04 '19 19:06 ganapativs

Re installing latest npm using the command curl -L https://www.npmjs.com/install.sh | sh fixes the issue in MacOS 🎉

ganapativs avatar Jun 04 '19 20:06 ganapativs

on windows a similar situation, rolled back to 6.8.0, there is no such problem.

PowerfulPony avatar Jun 04 '19 20:06 PowerfulPony

Re installing latest npm using the command curl -L https://www.npmjs.com/install.sh | sh fixes the issue in MacOS 🎉

thx a lot, I rolled nodejs back to v8.16, and it works fine.

jinggqu avatar Jun 05 '19 04:06 jinggqu

Yo igual tenía problemas con la versión de Windows e instale esta versión y se solucionó el problema Windows 64-bit Installer: https://nodejs.org/dist/v10.15.3/node-v10.15.3-x64.msi

WriestTavo avatar Jun 05 '19 19:06 WriestTavo

is it the official recommendation to downgrade to 10.15 for windows?

GaryB432 avatar Jun 12 '19 18:06 GaryB432

I downgraded to 10.15 and it worked

danieldicesare avatar Jun 21 '19 08:06 danieldicesare

Downgrade works for me (node 10.15)! (in Windows 7)

contrerasmarc avatar Jul 01 '19 10:07 contrerasmarc

God save me!

I have same error and node downgraded to 10.15.3 and works!

Detail info

  • Windows 10.0.18362.207
  • node 12.5.0
  • npm 6.9.0

Do not works any command "npm i xxx" and got this error TypeError: Cannot read property 'resolve' of undefined

jongfeel avatar Jul 02 '19 03:07 jongfeel

I don't believe. I f**** my build server because this version!

jenergm avatar Jul 03 '19 14:07 jenergm

Thanks to @jongfeel for his tip installing following fixed the problem; https://nodejs.org/download/release/v10.15.3/

All Releases: https://nodejs.org/en/download/releases/

reyou avatar Jul 04 '19 03:07 reyou

I too has the same problem, downgraded to Node 10.15.0 work for me.

Codedecks avatar Jul 26 '19 05:07 Codedecks

i resolve it with curl -L https://www.npmjs.com/install.sh |sodu sh

brainee avatar Jul 29 '19 10:07 brainee

this was happening to me as well but I was using the n package manager

what I did to solve it was downgrade my node version to an old version where npm doesn't throw a tantrum and install the latest version of n, after that all was good

npm i -g n@latest

eballeste avatar Jul 31 '19 16:07 eballeste

version 12.6.0 worked for me

iampeterbanjo avatar Aug 14 '19 21:08 iampeterbanjo

What solved it for me (Windows 10) was to install the 32 bit of 10.16.3 version.

mkotsollaris avatar Sep 04 '19 16:09 mkotsollaris

I'm also having the same problem, installed the 10.15.3 version of node js and problem got solved...

arushraj avatar Sep 14 '19 13:09 arushraj

Downgrading from 10.16.3 to 10.15.3 fixed things for me. Even the 12.3 LTS version didn't work.

davidkeaveny avatar Nov 25 '19 11:11 davidkeaveny

I'm using n and switching node from 10.16.3 to 10.15.0 works for me:

n 10.15.0

zyh41 avatar Dec 06 '19 06:12 zyh41

I am too experiencing this on Windows. Downgraded to 10.15.0 and it seems to work just fine.

ccarv avatar Feb 07 '20 16:02 ccarv