任务:webpack 失败,无法读取未定义的 属性 'forEach'
Task :webpack FAILED , Cannot read property 'forEach' of undefined
在项目目录中执行 ./gradlew
构建 jhipster 项目时遇到错误。
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :webpack
> oauth-2@0.0.1-SNAPSHOT webpack:build /home/lina/PCD/app
> npm run cleanup && npm run webpack:build:main
> oauth-2@0.0.1-SNAPSHOT cleanup /home/lina/PCD/app
> rimraf build/resources/main/static/ build/resources/main/aot
> oauth-2@0.0.1-SNAPSHOT webpack:build:main /home/lina/PCD/app
> npm run webpack -- --config webpack/webpack.dev.js --env.stats=minimal
> oauth-2@0.0.1-SNAPSHOT webpack /home/lina/PCD/app
> node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js "--config" "webpack/webpack.dev.js" "--env.stats=minimal"
Webpack: Starting ...
Starting type checking service...
Webpack: Starting ...
✔ Compile modules
✔ Build modules
✔ Optimize modules
✔ Emit files
Webpack: Finished after 29.312 seconds.
ERROR Failed to compile with 2 errors3:54:41 PM
Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
Cannot read property 'forEach' of undefined
at PoolWorker.fromErrorObj (/home/lina/PCD/app/node_modules/thread-loader/dist/WorkerPool.js:262:12)
at /home/lina/PCD/app/node_modules/thread-loader/dist/WorkerPool.js:204:29
at mapSeries (/home/lina/PCD/app/node_modules/neo-async/async.js:3625:14)
at PoolWorker.onWorkerMessage (/home/lina/PCD/app/node_modules/thread-loader/dist/WorkerPool.js:170:35)
at Linter.parseResults (/home/lina/PCD/app/node_modules/eslint-loader/dist/Linter.js:121:13)
at Linter.printOutput (/home/lina/PCD/app/node_modules/eslint-loader/dist/Linter.js:85:26)
at Object.loader (/home/lina/PCD/app/node_modules/eslint-loader/dist/index.js:26:10)
Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 1)
Cannot read property 'forEach' of undefined
at PoolWorker.fromErrorObj (/home/lina/PCD/app/node_modules/thread-loader/dist/WorkerPool.js:262:12)
at /home/lina/PCD/app/node_modules/thread-loader/dist/WorkerPool.js:204:29
at mapSeries (/home/lina/PCD/app/node_modules/neo-async/async.js:3625:14)
at PoolWorker.onWorkerMessage (/home/lina/PCD/app/node_modules/thread-loader/dist/WorkerPool.js:170:35)
at Linter.parseResults (/home/lina/PCD/app/node_modules/eslint-loader/dist/Linter.js:121:13)
at Linter.printOutput (/home/lina/PCD/app/node_modules/eslint-loader/dist/Linter.js:85:26)
at Object.loader (/home/lina/PCD/app/node_modules/eslint-loader/dist/index.js:26:10)
npm ERR! errno 2
npm ERR! oauth-2@0.0.1-SNAPSHOT webpack: `node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js "--config" "webpack/webpack.dev.js" "--env.stats=minimal"`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the oauth-2@0.0.1-SNAPSHOT webpack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/lina/.npm/_logs/2019-12-19T00_33_28_433Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! oauth-2@0.0.1-SNAPSHOT webpack:build:main: `npm run webpack -- --config webpack/webpack.dev.js --env.stats=minimal`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the oauth-2@0.0.1-SNAPSHOT webpack:build:main script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/lina/.npm/_logs/2019-12-19T00_33_29_033Z-debug.log
> Task :webpack FAILED
FAILURE: Build failed with an exception.
这些细节可能会有用:
环境和工具
openjdk 版本“1.8.0_232”
OpenJDK 运行时环境 (build 1.8.0_232-8u232-b09-1~deb9u1-b09)
OpenJDK 64 位服务器 VM(构建 25.232-b09,混合模式)
- git 版本 2.11.0
- 节点:v12.13.1
- npm:6.13.4
- 自耕农:3.1.1
我 运行 它在 Debian 9 上(延伸)
任何帮助将不胜感激,谢谢。
感谢@Gaël Marziou
Failure is about eslint, so I suppose it also fails when you run npm
run lint? As a temporary workaround and to confirm there's an issue
with eslint could you comment out the eslint-loader rule configuration
in webpack/webpack.dev.js like below?
module: {
rules: [ /* {
test: /\.(j|t)s$/,
enforce: 'pre',
loader: 'eslint-loader',
exclude: /node_modules/
}, */
在项目目录中执行 ./gradlew
构建 jhipster 项目时遇到错误。
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :webpack
> oauth-2@0.0.1-SNAPSHOT webpack:build /home/lina/PCD/app
> npm run cleanup && npm run webpack:build:main
> oauth-2@0.0.1-SNAPSHOT cleanup /home/lina/PCD/app
> rimraf build/resources/main/static/ build/resources/main/aot
> oauth-2@0.0.1-SNAPSHOT webpack:build:main /home/lina/PCD/app
> npm run webpack -- --config webpack/webpack.dev.js --env.stats=minimal
> oauth-2@0.0.1-SNAPSHOT webpack /home/lina/PCD/app
> node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js "--config" "webpack/webpack.dev.js" "--env.stats=minimal"
Webpack: Starting ...
Starting type checking service...
Webpack: Starting ...
✔ Compile modules
✔ Build modules
✔ Optimize modules
✔ Emit files
Webpack: Finished after 29.312 seconds.
ERROR Failed to compile with 2 errors3:54:41 PM
Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
Cannot read property 'forEach' of undefined
at PoolWorker.fromErrorObj (/home/lina/PCD/app/node_modules/thread-loader/dist/WorkerPool.js:262:12)
at /home/lina/PCD/app/node_modules/thread-loader/dist/WorkerPool.js:204:29
at mapSeries (/home/lina/PCD/app/node_modules/neo-async/async.js:3625:14)
at PoolWorker.onWorkerMessage (/home/lina/PCD/app/node_modules/thread-loader/dist/WorkerPool.js:170:35)
at Linter.parseResults (/home/lina/PCD/app/node_modules/eslint-loader/dist/Linter.js:121:13)
at Linter.printOutput (/home/lina/PCD/app/node_modules/eslint-loader/dist/Linter.js:85:26)
at Object.loader (/home/lina/PCD/app/node_modules/eslint-loader/dist/index.js:26:10)
Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 1)
Cannot read property 'forEach' of undefined
at PoolWorker.fromErrorObj (/home/lina/PCD/app/node_modules/thread-loader/dist/WorkerPool.js:262:12)
at /home/lina/PCD/app/node_modules/thread-loader/dist/WorkerPool.js:204:29
at mapSeries (/home/lina/PCD/app/node_modules/neo-async/async.js:3625:14)
at PoolWorker.onWorkerMessage (/home/lina/PCD/app/node_modules/thread-loader/dist/WorkerPool.js:170:35)
at Linter.parseResults (/home/lina/PCD/app/node_modules/eslint-loader/dist/Linter.js:121:13)
at Linter.printOutput (/home/lina/PCD/app/node_modules/eslint-loader/dist/Linter.js:85:26)
at Object.loader (/home/lina/PCD/app/node_modules/eslint-loader/dist/index.js:26:10)
npm ERR! errno 2
npm ERR! oauth-2@0.0.1-SNAPSHOT webpack: `node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js "--config" "webpack/webpack.dev.js" "--env.stats=minimal"`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the oauth-2@0.0.1-SNAPSHOT webpack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/lina/.npm/_logs/2019-12-19T00_33_28_433Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! oauth-2@0.0.1-SNAPSHOT webpack:build:main: `npm run webpack -- --config webpack/webpack.dev.js --env.stats=minimal`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the oauth-2@0.0.1-SNAPSHOT webpack:build:main script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/lina/.npm/_logs/2019-12-19T00_33_29_033Z-debug.log
> Task :webpack FAILED
FAILURE: Build failed with an exception.
这些细节可能会有用: 环境和工具 openjdk 版本“1.8.0_232” OpenJDK 运行时环境 (build 1.8.0_232-8u232-b09-1~deb9u1-b09) OpenJDK 64 位服务器 VM(构建 25.232-b09,混合模式) - git 版本 2.11.0 - 节点:v12.13.1 - npm:6.13.4 - 自耕农:3.1.1
我 运行 它在 Debian 9 上(延伸) 任何帮助将不胜感激,谢谢。
感谢@Gaël Marziou
Failure is about eslint, so I suppose it also fails when you run npm run lint? As a temporary workaround and to confirm there's an issue with eslint could you comment out the eslint-loader rule configuration in webpack/webpack.dev.js like below?
module: {
rules: [ /* {
test: /\.(j|t)s$/,
enforce: 'pre',
loader: 'eslint-loader',
exclude: /node_modules/
}, */