I'm trying to install eslint globally using npm install -g eslint. This is a fresh version of [email protected]/[email protected] installed using nvm. The error I'm getting is:
Stacktrace:
0 info it worked if it ends with ok 1 verbose cli [ '/Users/fitvalet/.nvm/versions/node/v7.2.1/bin/node', 1 verbose cli '/Users/fitvalet/.nvm/versions/node/v7.2.1/bin/npm', 1 verbose cli 'install', 1 verbose cli '-g', 1 verbose cli 'eslint' ] 2 info using [email protected] 3 info using [email protected] 4 silly loadCurrentTree Starting 5 silly install loadCurrentTree 6 silly install readGlobalPackageData 7 silly fetchPackageMetaData eslint 8 silly fetchNamedPackageData eslint 9 silly mapToRegistry name eslint 10 silly mapToRegistry using default registry 11 silly mapToRegistry registry 12 silly mapToRegistry data Result { 12 silly mapToRegistry raw: 'eslint', 12 silly mapToRegistry scope: null, 12 silly mapToRegistry escapedName: 'eslint', 12 silly mapToRegistry name: 'eslint', 12 silly mapToRegistry rawSpec: '', 12 silly mapToRegistry spec: 'latest', 12 silly mapToRegistry type: 'tag' } 13 silly mapToRegistry uri 14 verbose request uri 15 verbose request no auth needed 16 info attempt registry request try #1 at 1:59:17 PM 17 verbose request id 066241c6e4150db4 18 http request GET 19 http 200 20 verbose headers { 'cache-control': 'must-revalidate', 20 verbose headers connection: 'close', 20 verbose headers 'content-type': 'application/json', 20 verbose headers date: 'Tue, 13 Dec 2016 18:59:17 GMT', 20 verbose headers server: 'CouchDB/2.0.0 (Erlang OTP/R16B03)', 20 verbose headers 'transfer-encoding': 'chunked', 20 verbose headers 'content-encoding': 'gzip', 20 verbose headers 'strict-transport-security': 'max-age=2592000000; includeSubDomains; preload;' } 21 silly get cb [ 200, 21 silly get { 'cache-control': 'must-revalidate', 21 silly get connection: 'close', 21 silly get 'content-type': 'application/json', 21 silly get date: 'Tue, 13 Dec 2016 18:59:17 GMT', 21 silly get server: 'CouchDB/2.0.0 (Erlang OTP/R16B03)', 21 silly get 'transfer-encoding': 'chunked', 21 silly get 'content-encoding': 'gzip', 21 silly get 'strict-transport-security': 'max-age=2592000000; includeSubDomains; preload;' } ] 22 verbose get saving undefined to /Users/fitvalet/.npm/ 23 verbose correctMkdir /Users/fitvalet/.npm correctMkdir not in flight; initializing 24 verbose makeDirectory /Users/fitvalet/.npm creation not in flight; initializing 25 silly makeDirectory /Users/fitvalet/.npm uid: 501 gid: 20 26 verbose stack TypeError: Cannot convert undefined or null to object 26 verbose stack at Function.keys (<anonymous>) 26 verbose stack at pickVersionFromRegistryDocument (/Users/fitvalet/.nvm/versions/node/v7.2.1/lib/node_modules/npm/lib/fetch-package-metadata.js:125:29) 26 verbose stack at /Users/fitvalet/.nvm/versions/node/v7.2.1/lib/node_modules/npm/node_modules/iferr/index.js:13:50 26 verbose stack at /Users/fitvalet/.nvm/versions/node/v7.2.1/lib/node_modules/npm/lib/utils/pulse-till-done.js:20:8 26 verbose stack at saved (/Users/fitvalet/.nvm/versions/node/v7.2.1/lib/node_modules/npm/lib/cache/caching-client.js:174:7) 26 verbose stack at /Users/fitvalet/.nvm/versions/node/v7.2.1/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:241:18 26 verbose stack at FSReqWrap.oncomplete (fs.js:111:15) 27 verbose cwd /Users/fitvalet 28 error Darwin 16.1.0 29 error argv "/Users/fitvalet/.nvm/versions/node/v7.2.1/bin/node" "/Users/fitvalet/.nvm/versions/node/v7.2.1/bin/npm" "install" "-g" "eslint" 30 error node v7.2.1 31 error npm v3.10.10 32 error Cannot convert undefined or null to object 33 error If you need help, you may report this error at: 33 error < 34 verbose exit [ 1, true ] 6 Answers
The issue was that I had an old .npmrc that pointed to an the npm registry using skimdb.npmjs.org. I removed the file and my modules now install fine.
I could check the registry by typing npm config list registry which now points to what I suppose is the default:
Weird but I just downgraded npm from 8.5.2 to 6.14.16 and everything started to work.
1This is mostly because of poor internet connection speed
OR older version of npm
For internet connection issue try below
You can try below to make it working
npm install --prefer-offline --no-audit secondly You can add project .npmrc file and add below lines
fetch-retry-maxtimeout = 6000000 fetch-retry-mintimeout = 1000000 Also you can try npm config set timeout 6000000
For older npm related try below
npm install -g [email protected] If you don't know the versions of npm, use below command to list
npm view npm versions You might need to update your node version as well , to update node using nvm
nvm use 10 Then try npm install
If this still give error try with yarn instead of npm.
the problem is with the npm registry run this: npm config get registry
and see if it is set to the desired URI default registry should set to
Webstorm can debug npm cli with following conf:
add npm cli opt --loglevel verbose to show error stack trace detail
in webstorm set breakpoint in stack trace line to find what cause this error
in my case, the error is caused by a dep in package.json
Had the same problem with npm install
I'm getting better results with npm install --legacy-peer-deps
Of course, if you don't want that option, this isn't good for you.
