npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Cannot read property 'resolve' of undefined

I can’t download any module with npm. I get the following error:

info it worked if it ends with ok
1 verbose cli [ ‘C:\Program Files\nodejs\node.exe’,
1 verbose cli ‘C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js’,
1 verbose cli ‘install’,
1 verbose cli ‘mssql’ ]
2 info using npm@6.9.0
3 info using node@v10.16.3
4 verbose npm-session 637b1972b5658406
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData error for mssql@latest Cannot read property ‘resolve’ of undefined
8 timing stage:rollbackFailedOptional Completed in 2ms
9 timing stage:runTopLevelLifecycles Completed in 395ms
10 verbose stack TypeError: Cannot read property ‘resolve’ of undefined
10 verbose stack at regFetch (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-fetch\index.js:76:23)
10 verbose stack at fetchPackument (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\fetchers\registry\packument.js:42:10)
10 verbose stack at packument (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\fetchers\registry\packument.js:20:10)
10 verbose stack at getManifest (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\fetchers\registry\manifest.js:22:10)
10 verbose stack at manifest (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\fetchers\registry\manifest.js:13:10)
10 verbose stack at Object.manifest (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\fetchers\registry\index.js:17:12)
10 verbose stack at Object.Fetcher#manifest [as manifest] (C:\Program Files\nodejs\node_modules\npm\node_modules\genfun\lib\genfun.js:15:38)
10 verbose stack at manifest (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\lib\fetch.js:23:18)
10 verbose stack at pinflight (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\manifest.js:24:12)
10 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\promise-inflight\inflight.js:29:24
10 verbose stack at Promise._execute (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\debuggability.js:313:9)
10 verbose stack at Promise._resolveFromExecutor (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:483:18)
10 verbose stack at new Promise (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:79:10)
10 verbose stack at _inflight (C:\Program Files\nodejs\node_modules\npm\node_modules\promise-inflight\inflight.js:28:25)
10 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\promise-inflight\inflight.js:22:14
10 verbose stack at tryCatcher (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
11 verbose cwd D:\Projects\Guncel\WiloomServiceInit\WiloomServiceInit
12 verbose Windows_NT 10.0.17134
13 verbose argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” “install” “mssql”
14 verbose node v10.16.3
15 verbose npm v6.9.0
16 error Cannot read property ‘resolve’ of undefined
17 verbose exit [ 1, true ]

Does this happen in other projects, or just one? (e.g. creating a new project and trying an install there)

I get the error in all the new projects I add.
I follow these steps:
1- I am creating a new directory.
2- I created “package.json” file by typing “npm init” into the directory I created.
3- I get the same error when I type “npm install express”.

I suspect you have a broken install of npm. I suggest reinstalling node (which includes npm and so will also reinstall npm).