因此,从昨天开始,当我尝试将我的项目部署到 Heroku 或 Now 时,我开始收到以下构建错误。在本地,该项目运行良好。这里有什么问题,我该如何解决?
现在,日志内容如下:
02/04 10:38 AM (7m)
Error: static/chunks/commons.2ab19e066e0721785714.js from Terser
TypeError: Cannot read property 'minify' of undefined
at minify (/tmp/3d5396dc/node_modules/terser-webpack-plugin/dist/minify.js:162:59)
at TaskRunner.boundWorkers (/tmp/3d5396dc/node_modules/terser-webpack-plugin/dist/TaskRunner.js:62:41)
at enqueue (/tmp/3d5396dc/node_modules/terser-webpack-plugin/dist/TaskRunner.js:82:14)
at tryCatcher (/tmp/3d5396dc/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/tmp/3d5396dc/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/tmp/3d5396dc/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/tmp/3d5396dc/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/tmp/3d5396dc/node_modules/bluebird/js/release/promise.js:690:18)
at _drainQueueStep (/tmp/3d5396dc/node_modules/bluebird/js/release/async.js:138:12)
at _drainQueue (/tmp/3d5396dc/node_modules/bluebird/js/release/async.js:131:9)
at Async._drainQueues (/tmp/3d5396dc/node_modules/bluebird/js/release/async.js:147:5)
at Immediate.Async.drainQueues (/tmp/3d5396dc/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:794:20)
at tryOnImmediate (timers.js:752:5)
at processImmediate [as _immediateCallback] (timers.js:729:5)
at Function.buildError (/tmp/3d5396dc/node_modules/terser-webpack-plugin/dist/index.js:111:14)
at results.forEach (/tmp/3d5396dc/node_modules/terser-webpack-plugin/dist/index.js:255:50)
at Array.forEach (<anonymous>)
at taskRunner.run (/tmp/3d5396dc/node_modules/terser-webpack-plugin/dist/index.js:242:17)
at step (/tmp/3d5396dc/node_modules/terser-webpack-plugin/dist/TaskRunner.js:76:9)
at done (/tmp/3d5396dc/node_modules/terser-webpack-plugin/dist/TaskRunner.js:84:30)
at boundWorkers (/tmp/3d5396dc/node_modules/terser-webpack-plugin/dist/TaskRunner.js:89:13)
at TaskRunner.boundWorkers (/tmp/3d5396dc/node_modules/terser-webpack-plugin/dist/TaskRunner.js:64:11)
at enqueue (/tmp/3d5396dc/node_modules/terser-webpack-plugin/dist/TaskRunner.js:82:14)
at tryCatcher (/tmp/3d5396dc/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/tmp/3d5396dc/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/tmp/3d5396dc/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/tmp/3d5396dc/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/tmp/3d5396dc/node_modules/bluebird/js/release/promise.js:690:18)
at _drainQueueStep (/tmp/3d5396dc/node_modules/bluebird/js/release/async.js:138:12)
at _drainQueue (/tmp/3d5396dc/node_modules/bluebird/js/release/async.js:131:9) Error: static/runtime/webpack-42652fa8b82c329c0559.js from Terser
在 Heroku 上,他们读为:
2019-02-04T10:58:23.286953+00:00 app[web.1]: at __webpack_require__ (/app/.next/server/static/KANAUI~IRZ6dj1SV~XfmF/pages/_app.js:23:31)
2019-02-04T10:58:23.286955+00:00 app[web.1]: at Object.<anonymous> (/app/.next/server/static/KANAUI~IRZ6dj1SV~XfmF/pages/_app.js:1337:18)
2019-02-04T10:58:23.286956+00:00 app[web.1]: at __webpack_require__ (/app/.next/server/static/KANAUI~IRZ6dj1SV~XfmF/pages/_app.js:23:31) code: 'MODULE_NOT_FOUND' }
2019-02-04T10:58:23.287670+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Error: Cannot find module 'graphql-tools'
2019-02-04T10:58:23.287672+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
2019-02-04T10:58:23.287674+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:507:25)
2019-02-04T10:58:23.287675+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:637:17)
2019-02-04T10:58:23.287676+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:22:18)
2019-02-04T10:58:23.287678+00:00 app[web.1]: at Object.<anonymous> (/app/.next/server/static/KANAUI~IRZ6dj1SV~XfmF/pages/index.js:2110:18)
2019-02-04T10:58:23.287679+00:00 app[web.1]: at __webpack_require__ (/app/.next/server/static/KANAUI~IRZ6dj1SV~XfmF/pages/index.js:23:31)
2019-02-04T10:58:23.287680+00:00 app[web.1]: at Object.<anonymous> (/app/.next/server/static/KANAUI~IRZ6dj1SV~XfmF/pages/index.js:341:31)
2019-02-04T10:58:23.287681+00:00 app[web.1]: at __webpack_require__ (/app/.next/server/static/KANAUI~IRZ6dj1SV~XfmF/pages/index.js:23:31)
2019-02-04T10:58:23.287682+00:00 app[web.1]: at Object.<anonymous> (/app/.next/server/static/KANAUI~IRZ6dj1SV~XfmF/pages/index.js:1337:18)
2019-02-04T10:58:23.287683+00:00 app[web.1]: at __webpack_require__ (/app/.next/server/static/KANAUI~IRZ6dj1SV~XfmF/pages/index.js:23:31)
2019-02-04T10:58:23.287772+00:00 app[web.1]: (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 133)
2019-02-04T10:59:23.314730+00:00 app[web.1]: { Error: Cannot find module 'graphql-tools'
2019-02-04T10:59:23.314741+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
2019-02-04T10:59:23.314743+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:507:25)
2019-02-04T10:59:23.314745+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:637:17)
2019-02-04T10:59:23.314746+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:22:18)
2019-02-04T10:59:23.314748+00:00 app[web.1]: at Object.<anonymous> (/app/.next/server/static/KANAUI~IRZ6dj1SV~XfmF/pages/_app.js:2110:18)
2019-02-04T10:59:23.314750+00:00 app[web.1]: at __webpack_require__ (/app/.next/server/static/KANAUI~IRZ6dj1SV~XfmF/pages/_app.js:23:31)
2019-02-04T10:59:23.314752+00:00 app[web.1]: at Object.<anonymous> (/app/.next/server/static/KANAUI~IRZ6dj1SV~XfmF/pages/_app.js:341:31)
2019-02-04T10:59:23.314753+00:00 app[web.1]: at __webpack_require__ (/app/.next/server/static/KANAUI~IRZ6dj1SV~XfmF/pages/_app.js:23:31)
2019-02-04T10:59:23.314755+00:00 app[web.1]: at Object.<anonymous> (/app/.next/server/static/KANAUI~IRZ6dj1SV~XfmF/pages/_app.js:1337:18)
2019-02-04T10:59:23.314756+00:00 app[web.1]: at __webpack_require__ (/app/.next/server/static/KANAUI~IRZ6dj1SV~XfmF/pages/_app.js:23:31) code: 'MODULE_NOT_FOUND' }