首页 > 解决方案 > NPM 安装 - npm 错误!代码 EINVALIDTYPE

问题描述

在其他设备中清理和设置环境后,我面临很多问题。它不允许我构建我的项目 grunt build 在处理图像后卡住了

npm  install
npm ERR! code EINVALIDTYPE
npm ERR! typeerror Error: Argument #5: Expected object but got string
npm ERR! typeerror     at inflatableChild     (C:\Users\YouStable\AppData\Roaming\npm\node_modules\npm\lib\install\inflate-shrinkwrap.js:93:3)
npm ERR! typeerror     at BB.each (C:\Users\YouStable\AppData\Roaming\npm\node_modules\npm\lib\install\inflate-shrinkwrap.js:55:12)
npm ERR! typeerror     at tryCatcher (C:\Users\YouStable\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
npm ERR! typeerror     at Object.gotValue (C:\Users\YouStable\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\reduce.js:155:18)
npm ERR! typeerror     at Object.gotAccum (C:\Users\YouStable\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\reduce.js:144:25)
npm ERR! typeerror     at Object.tryCatcher (C:\Users\YouStable\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
npm ERR! typeerror     at Promise._settlePromiseFromHandler (C:\Users\YouStable\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31)
npm ERR! typeerror     at Promise._settlePromise (C:\Users\YouStable\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
npm ERR! typeerror     at Promise._settlePromiseCtx (C:\Users\YouStable\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:606:10)
npm ERR! typeerror     at _drainQueueStep (C:\Users\YouStable\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\async.js:142:12)
npm ERR! typeerror     at _drainQueue (C:\Users\YouStable\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\async.js:131:9)
npm ERR! typeerror     at Async._drainQueues (C:\Users\YouStable\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\async.js:147:5)
npm ERR! typeerror     at Immediate.Async.drainQueues [as _onImmediate] (C:\Users\YouStable\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\async.js:17:14)
npm ERR! typeerror     at processImmediate (timers.js:638:19)
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <https://npm.community>

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\YouStable\AppData\Roaming\npm-cache\_logs\2019-03-30T00_58_00_673Z-debug.log

标签: angularjsnpmgruntjsbower

解决方案


在使用node v6.11.2with 时npm v10.16.3,我也遇到了这个问题,
几乎想升级到最新版本:(

该问题是由于文件有些损坏而导致的,该package-lock.json文件npm install试图在任何新安装之前读取/配置依赖关系树。

我得到的最佳建议是从根文件夹中实际删除 package-lock.json文件。在那之后,我能够npm install成功。


推荐阅读