npm install throwing invalid type error

What I Wanted to Do

I was trying to install axios package for project

What Happened Instead

It showed some invalid type error

Reproduction Steps

npm install axios

Details

npm i axios
npm ERR! code EINVALIDTYPE
npm ERR! typeerror Error: Argument #5: Expected object but got string
npm ERR! typeerror     at inflatableChild (/usr/local/nodejs/lib/node_modules/npm/lib/install/inflate-shrinkwrap.js:93:3)
npm ERR! typeerror     at BB.each (/usr/local/nodejs/lib/node_modules/npm/lib/install/inflate-shrinkwrap.js:55:12)
npm ERR! typeerror     at tryCatcher (/usr/local/nodejs/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
npm ERR! typeerror     at Object.gotValue (/usr/local/nodejs/lib/node_modules/npm/node_modules/bluebird/js/release/reduce.js:155:18)
npm ERR! typeerror     at Object.gotAccum (/usr/local/nodejs/lib/node_modules/npm/node_modules/bluebird/js/release/reduce.js:144:25)
npm ERR! typeerror     at Object.tryCatcher (/usr/local/nodejs/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
npm ERR! typeerror     at Promise._settlePromiseFromHandler (/usr/local/nodejs/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
npm ERR! typeerror     at Promise._settlePromise (/usr/local/nodejs/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
npm ERR! typeerror     at Promise._settlePromiseCtx (/usr/local/nodejs/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:606:10)
npm ERR! typeerror     at Async._drainQueue (/usr/local/nodejs/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:138:12)
npm ERR! typeerror     at Async._drainQueues (/usr/local/nodejs/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10)
npm ERR! typeerror     at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/nodejs/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
npm ERR! typeerror     at runCallback (timers.js:763:18)
npm ERR! typeerror     at tryOnImmediate (timers.js:734:5)
npm ERR! typeerror     at processImmediate (timers.js:716:5)
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <https://npm.community>

Platform Info

$ npm --versions
{ 'sample-http': '0.0.1',
  npm: '6.3.0',
  ares: '1.13.0',
  cldr: '32.0.1',
  http_parser: '2.7.0',
  icu: '60.2',
  modules: '59',
  napi: '2',
  nghttp2: '1.29.0',
  node: '9.9.0',
  openssl: '1.0.2n',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.2',
  v8: '6.2.414.46-node.22',
  zlib: '1.2.11' }

I was not able to reproduce the problem. Does it work for you in a new project? (I am wondering if it is a problem in your package.json or package-lock.json.)

mkdir 8977
cd 8977
npm init -y
npm install axios

Thanks for pointing out… Yes i have some wrong entries in package-lock.json
Now its working fine

1 Like

Can you share the old package-lock.json that showed the problem? I’d love to fix the root cause bug, if it’s not already addressed in the latest release.