Error: Cannot find module ‘array-includes’【解决方法】

今天爱分享给大家带来Error: Cannot find module ‘array-includes’【解决方法】,希望能够帮助到大家。
把某个 Vue 项目拷贝一份之后,在拷贝后的新项目的目录下执行 npm start 命令后,报 Error: Cannot find module ‘array-includes’ 错误。

完整报错信息如下:


$ npm start

> xxx@1.0.0 start
> npm run dev


> xxx@1.0.0 dev
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js

node:internal/modules/cjs/loader:928
  throw err;
  ^

Error: Cannot find module 'array-includes'
Require stack:
- D:\work\201224\workspace\vue\xxx-client\node_modules\_webpack-dev-server@2.11.5@webpack-dev-server\lib\polyfills.js
- D:\work\201224\workspace\vue\xxx-client\node_modules\_webpack-dev-server@2.11.5@webpack-dev-server\bin\webpack-dev-server.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object. (D:\work\201224\workspace\vue\xxx-client\node_modules\_webpack-dev-server@2.11.5@webpack-dev-server\lib\polyfills.js:6:18)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:997:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'D:\\work\\201224\\workspace\\vue\\xxx-client\\node_modules\\_webpack-dev-server@2.11.5@webpack-dev-server\\lib\\polyfills.js',
    'D:\\work\\201224\\workspace\\vue\\xxx-client\\node_modules\\_webpack-dev-server@2.11.5@webpack-dev-server\\bin\\webpack-dev-server.js'
  ]
}
npm ERR! code 1
npm ERR! path D:\work\201224\workspace\vue\xxx-client
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c webpack-dev-server --inline --progress --config build/webpack.dev.conf.js

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xxx\AppData\Local\npm-cache\_logs\2020-12-24T14_00_42_901Z-debug.log
npm ERR! code 1
npm ERR! path D:\work\201224\workspace\vue\xxx-client
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c npm run dev

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xxx\AppData\Local\npm-cache\_logs\2020-12-24T14_00_42_948Z-debug.log


解决方法
删除 node_modules 整个文件夹和 package-lock.json 文件(这个文件不一定有),注意不是 package.json
在项目下运行 npm install
继续运行 npm start ,问题解决

人已赞赏
前端

JS中什么是作用域链(scope chain)【面试题详解】

2020-12-29 17:55:29

前端

Do not use ‘new‘ for side effects【解决方法】

2020-12-30 22:04:35

'); })();