react 启动异常 & 代码未做任何改动 =》怀疑安装elint时包有问题

错误日志:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
\jsx> yarn start
yarn run v1.19.1
$ node ./YarnStartPreCheck.js && react-app-rewired start
internal/modules/cjs/loader.js:797
    throw err;
    ^
 
Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
Require stack:
- D:………………\jsx\node_modules\html-webpack-plugin\lib\compiler.js
- D:………………\jsx\node_modules\html-webpack-plugin\index.js
- D:………………\jsx\node_modules\react-scripts\config\webpack.config.js
- D:………………\jsx\node_modules\react-app-rewired\scripts\start.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (D:………………\jsx\node_modules\html-webpack-plugin\lib\compiler.js:14:28)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'D:\\……………………\\jsx\\node_modules\\html-webpack-plugin\\lib\\compiler.js',
    'D:\\………………\\jsx\\node_modules\\html-webpack-plugin\\index.js',
    'D:\\………………\\jsx\\node_modules\\react-scripts\\config\\webpack.config.js',
    'D:\\………………\\jsx\\node_modules\\react-app-rewired\\scripts\\start.js'
  ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

  

撤销代码修改、配置修改,yarn start,错误同上(非代码、配置问题)

 

重新安装yarn: yarn install,错误同上(非 yarn版本问题)。

 

查找.gitignore文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
 
# dependencies
/node_modules
/dist
/__MOCK__
/.pnp
.pnp.js
/src/index.js
 
# testing
/coverage
 
# production
/build
 
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
 
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock

  

 

删除文件夹:node_modules & dist

重新安装yarn: yarn install  (yarn install //安装package.json里所有包,并将包及它的所有依赖项保存进yarn.lock

重新运行:成功  (maybe:包安装冲突 or 包缺失)

 

posted @   PanPan003  阅读(329)  评论(0编辑  收藏  举报
编辑推荐:
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
阅读排行:
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· 没有源码,如何修改代码逻辑?
· NetPad:一个.NET开源、跨平台的C#编辑器
· 面试官:你是如何进行SQL调优的?
历史上的今天:
2019-03-15 HTTP之gRPC
2019-03-15 python学习2——模块
2019-03-15 Markdown介绍
点击右上角即可分享
微信分享提示