任务:webpack失败,无法读取未定义的属性“ forEach”

时间:2019-12-19 15:11:39

标签: node.js angular npm webpack jhipster

通过在项目目录中执行./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运行时环境(内部版本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上运行它(拉伸) 任何帮助将不胜感激,谢谢。

1 个答案:

答案 0 :(得分:0)

感谢@GaëlMarziou

  

失败与eslint有关,所以我想当您运行npm时它也会失败   运行皮棉?作为临时解决方法,并确认存在问题   使用eslint可以注释掉eslint-loader规则配置   在webpack / webpack.dev.js中,如下所示?

module: {
    rules: [ /* {
        test: /\.(j|t)s$/,
        enforce: 'pre',
        loader: 'eslint-loader',
        exclude: /node_modules/
    }, */