npm ERR! Cannot read property 'match' of undefined 错误处理

npm install 忽然报这个错 以前仍是好好地node

npm ERR! Cannot read property 'match' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2018-08-06T01_49_46_486Z-debug.log

回忆了一下 应该是项目多出了package-lock.json致使的npm

按照如下步骤依次操做便可:json

  1. npm cache clear --force (执行完成后npm install 没效再执行步骤2)
  2. 删了项目文件夹下面的package-lock.json,而后再运行npm install(没效执行步骤3)
  3. rm -rf node_modules
    rm package-lock.json
    npm cache clear --force
    npm install