首页 > 编程语言 >react 启动报错 ERROR in ./node_modules/fs-extra/lib/copy/copy-sync.js 5:13-28

react 启动报错 ERROR in ./node_modules/fs-extra/lib/copy/copy-sync.js 5:13-28

时间:2022-09-01 22:12:57浏览次数:65  
标签:node resolve modules include 报错 path fallback copy

项目运行好好的,然后就报一堆错误

起初我以为我安装了依赖倒置的问题,后来我只输出 hello world 都出错。折腾两晚上。。。还是度娘帮了我

Compiled with problems:X

ERROR in ./node_modules/fs-extra/lib/copy/copy-sync.js 5:13-28

Module not found: Error: Can't resolve 'path' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\fs-extra\lib\copy'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }


ERROR in ./node_modules/fs-extra/lib/copy/copy.js 5:13-28

Module not found: Error: Can't resolve 'path' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\fs-extra\lib\copy'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }


ERROR in ./node_modules/fs-extra/lib/empty/index.js 7:13-28

Module not found: Error: Can't resolve 'path' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\fs-extra\lib\empty'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }


ERROR in ./node_modules/fs-extra/lib/ensure/file.js 5:13-28

Module not found: Error: Can't resolve 'path' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\fs-extra\lib\ensure'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }


ERROR in ./node_modules/fs-extra/lib/ensure/link.js 5:13-28

Module not found: Error: Can't resolve 'path' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\fs-extra\lib\ensure'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }


ERROR in ./node_modules/fs-extra/lib/ensure/symlink-paths.js 3:13-28

Module not found: Error: Can't resolve 'path' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\fs-extra\lib\ensure'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }


ERROR in ./node_modules/fs-extra/lib/ensure/symlink.js 5:13-28

Module not found: Error: Can't resolve 'path' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\fs-extra\lib\ensure'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }


ERROR in ./node_modules/fs-extra/lib/mkdirs/utils.js 8:13-28

Module not found: Error: Can't resolve 'path' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\fs-extra\lib\mkdirs'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }


ERROR in ./node_modules/fs-extra/lib/move/move-sync.js 5:13-28

Module not found: Error: Can't resolve 'path' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\fs-extra\lib\move'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }


ERROR in ./node_modules/fs-extra/lib/move/move.js 5:13-28

Module not found: Error: Can't resolve 'path' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\fs-extra\lib\move'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }


ERROR in ./node_modules/fs-extra/lib/output-file/index.js 7:13-28

Module not found: Error: Can't resolve 'path' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\fs-extra\lib\output-file'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }


ERROR in ./node_modules/fs-extra/lib/remove/rimraf.js 5:13-28

Module not found: Error: Can't resolve 'path' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\fs-extra\lib\remove'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }


ERROR in ./node_modules/fs-extra/lib/remove/rimraf.js 7:15-32

Module not found: Error: Can't resolve 'assert' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\fs-extra\lib\remove'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "assert": require.resolve("assert/") }'
    - install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "assert": false }


ERROR in ./node_modules/fs-extra/lib/util/stat.js 5:13-28

Module not found: Error: Can't resolve 'path' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\fs-extra\lib\util'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }


ERROR in ./node_modules/fs-extra/lib/util/stat.js 7:13-28

Module not found: Error: Can't resolve 'util' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\fs-extra\lib\util'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }'
    - install 'util'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "util": false }


ERROR in ./node_modules/graceful-fs/graceful-fs.js 1:9-22

Module not found: Error: Can't resolve 'fs' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\graceful-fs'


ERROR in ./node_modules/graceful-fs/graceful-fs.js 9:11-26

Module not found: Error: Can't resolve 'util' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\graceful-fs'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }'
    - install 'util'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "util": false }


ERROR in ./node_modules/graceful-fs/graceful-fs.js 86:6-29

Module not found: Error: Can't resolve 'assert' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\graceful-fs'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "assert": require.resolve("assert/") }'
    - install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "assert": false }


ERROR in ./node_modules/graceful-fs/legacy-streams.js 1:13-37

Module not found: Error: Can't resolve 'stream' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\graceful-fs'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
    - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "stream": false }


ERROR in ./node_modules/graceful-fs/polyfills.js 1:16-36

Module not found: Error: Can't resolve 'constants' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\graceful-fs'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "constants": require.resolve("constants-browserify") }'
    - install 'constants-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "constants": false }


ERROR in ./node_modules/jsonfile/index.js 6:8-21

Module not found: Error: Can't resolve 'fs' in 'D:\vueLearning\selfLearningProject\react-lesson\0706\node_modules\jsonfile'

找到react 项目中的webpack.config.js

// 290 行
resolve: { // This allows you to set a fallback for where webpack should look for modules. // We placed these paths second because we want `node_modules` to "win" // if there are any conflicts. This matches Node resolution mechanism. // https://github.com/facebook/create-react-app/issues/253 fallback: { "path": false, "assert": false, "stream": false, "constants": false, "util": false, "fs": false, }, }

完美解决,可以重启成功启动起来

这是因为有些包是Node.js的一部分,但它们在浏览器中不存在。

您需要指出它们或将它们设置为false。

更新您的网页包配置,将出现错误的软件包设置为false:os、dns、crypto、fs、net。或者更好的是,添加所有这些:

ps: https://www.5axxw.com/questions/content/ibfep2#question-recommend

标签:node,resolve,modules,include,报错,path,fallback,copy
From: https://www.cnblogs.com/chuanmin/p/16647899.html

相关文章

  • 报错:①Tog goal specified requires a project to execute but there is no POM in th
    在运行Maven的命令时,在DOS窗口里面必须把目录切换到项目的根部,要不然命令是找不到目的地。下图是错误示范,项目在Demo02这个目录里,就必须将目录切换到Demo02下,否则DOS窗口......
  • jenkins报错
    课前回顾Jenkins的插件安装Jenkins插件管理页面各大镜像源手动安装,下载hpi文件Jenkinsfreestyle风格请简述至少三个Jenkinsjob的自动构建策略,并连接一种策略实现......
  • Scala运行报错 此时不应有 \scala\bin\..\lib\jline-2.14.6.jar。
    背景安装的Scala2.13.0,看报错是因为少了引号转义。不过实际看代码发现情况有点离谱。解决方案把scala.bat中的:add_cpath子程序换成下面这样:add_cpathif"%_TOOL......
  • idea web项目运行报错404
    背景运行springMVC时报错404,源服务器未能找到目标资源的表示或者是不愿公开一个已经存在的资源表示,index.jsp可以进入,但是其他页面无法进入。原因用百度上的方法都无法......
  • python serial报错问题
    参考一个python脚本,使用串口采集数据,但在执行时发现importserialimportserial.threaded有问题:解决方法很简单,使用pip命令执行pipinstallpyserial注意这里是pyse......
  • 关于docker创建容器报错-docker: Error response from daemon: runtime "io.container
    今天在对一台服务器(docker相关的业务服务器)进行OS补丁时,默认使用的yumupdate-y对所有的安装包进行了升级升级完成后,让应用方检查确认应用及功能是否一切正常,如果不正......
  • 记一次feign调用报错:feign.codec.DecodeException: Error while extracting response
    一直以为是被调用法的返回对象类型和调用方接收的对象类型不一致导致的解析失败甚至以为无法传递除Jsondate以外的类型 实际问题:多服务调用导出用到多线程token无法......
  • K8S 设置node最大pod数量
    1.默认情况下k8s一个node最多起110个pod。2.在node上设置打开文件/var/lib/kubelet/config.yaml3.修改参数maxPods为指定的值。4.node端重启kubelet:systemctlrest......
  • nodejs base64 编码解码
    一、普通字符串编码varb=newBuffer('JavaScript');vars=b.toString('base64');//SmF2YVNjcmlwdA==解码:varb=newBuffer('SmF2YVNjcmlwdA==','base64')......
  • onenote突然无法同步,同步报错以及创建笔记本都报错问题解决
    同步报错:OneNote当前无法同步笔记。将继续尝试。(错误代码:0x80004005bdf5j)创建笔记本报错:OneNote无法在以下位置新建笔记本打开笔记本报错:无法打开笔记本无法打开......