【问题标题】:In a React app, error with command npm start在 React 应用程序中,命令 npm start 出错
【发布时间】:2022-06-11 01:08:48
【问题描述】:

在我的项目flux-react-router-example中,我的webpack.config.js文件如下:

var path = require('path'); var webpack = require('webpack'); 模块.exports = { 入口: [ 'webpack-hot-middleware/client', './脚本/索引' ], devtool: 'eval-source-map', 输出: { 路径:__dirname, 文件名:'bundle.js', 公共路径:'/静态/' }, 插件:[ 新的 webpack.HotModuleReplacementPlugin(), ], 优化: [ 新的 webpack.optimization.emitOnErrors() ], 模块: { 装载机:[{ 测试:/\.js$/, 装载机:['babel'], 包括:path.join(__dirname, 'scripts') }] } };

我在 Visual Studio 代码中的终端是这样说的:

C:\Users\p-c\Downloads\Github\flux-react-router-example\webpack.config.js:20 新的 webpack.optimization.emitOnErrors() ^ TypeError:无法读取未定义的属性(读取“emitOnErrors”) 在对象。 (C:\Users\p-c\Downloads\Github\flux-react-router-example\webpack.config.js:20:30) 在 Module._compile (node:internal/modules/cjs/loader:1105:14) 在 Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) 在 Module.load (node:internal/modules/cjs/loader:981:32) 在 Function.Module._load (node:internal/modules/cjs/loader:822:12) 在 Module.require (node:internal/modules/cjs/loader:1005:19) 在需要(节点:内部/模块/cjs/helpers:102:18) 在对象。 (C:\Users\p-c\Downloads\Github\flux-react-router-example\server.js:4:14) 在 Module._compile (node:internal/modules/cjs/loader:1105:14) 在 Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)

我的 webpack 版本是 webpack@5.73.0
我的节点版本是 v16.15.0
我的 npm 版本是 8.3.1

【问题讨论】:

标签: reactjs webpack


猜你喜欢
  • 1970-01-01
  • 2020-09-30
  • 2022-01-20
  • 2023-03-07
  • 2018-06-20
  • 2021-03-16
  • 2020-01-26
  • 2021-04-23
  • 1970-01-01
相关资源
最近更新 更多