小编aus*_*_10的帖子

(Create-React-App) 找不到模块:您尝试导入不属于项目的 /node_modules/console-browserify/index.js

最近升级到了 React-scripts 版本 5.0.1,为此,我需要通过导入NodePolyfillPlugin我的 React-scripts 配置并将其添加到插件中来重新添加对 Node.js 核心模块的支持。这确实解决了我看到的错误,但现在我在尝试执行以下操作时遇到了一些新错误npm start

Module not found: Error: You attempted to import /node_modules/console-browserify/index.js which falls outside of the project directory.
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述 对 console-browserify 的唯一引用来自 NodePolyfillPlugin。有谁知道为什么会发生这种情况以及我该如何解决它?

node.js reactjs react-scripts create-react-app

6
推荐指数
1
解决办法
1306
查看次数