可观察性模块在nodejs中的Heroku构建步骤失败,在开发环境中工作

qhhrdooz  于 11个月前  发布在  Node.js
关注(0)|答案(1)|浏览(127)

我最近尝试在代码中添加可观察性模块,我尝试了Hive和新遗物。
两者在我的开发环境中工作得非常好,并连接到各自的平台,当我用我的web pack配置构建前端代码时,它也可以工作。
我认为这与Heroku的构建步骤有关,但我不确定如何解决它。
当我尝试在生产环境中部署时,我似乎从两个模块中得到了相同的错误(我每次都用deployed和double checked来反转提交,所以我知道这很可能不是代码中的另一个因素+它在开发环境中工作,没有问题,到目前为止,prod中的代码没有任何问题):

Build
Running build
> [email protected] build
> webpack
assets by status 1.89 MiB [cached] 4 assets
orphan modules 364 KiB [orphan] 78 modules
runtime modules 792 bytes 4 modules
modules by path ./node_modules/@babel/polyfill/node_modules/core-js/modules/*.js 190 KiB 273 modules
modules by path ./node_modules/@babel/polyfill/node_modules/core-js/library/ 6.43 KiB 18 modules
modules by path ./node_modules/@babel/polyfill/node_modules/core-js/fn/ 1.29 KiB 11 modules
modules by path ./src/ 536 KiB
./src/pages/create.js 894 bytes [built] [code generated]
+ 3 modules
modules by path ./node_modules/@babel/polyfill/lib/*.js 1.22 KiB
./node_modules/@babel/polyfill/lib/index.js 686 bytes [built] [code generated]
./node_modules/@babel/polyfill/lib/noConflict.js 567 bytes [built] [code generated]
./node_modules/@babel/polyfill/node_modules/core-js/es6/index.js 5.78 KiB [built] [code generated]
./node_modules/@babel/polyfill/node_modules/core-js/web/index.js 157 bytes [built] [code generated]
./node_modules/regenerator-runtime/runtime.js 24.3 KiB [built] [code generated]
ERROR in ./node_modules/axios/lib/axios.js 18:0-46
Module not found: Error: Can't resolve './adapters/adapters.js' in '/tmp/build_64aff3bc/node_modules/axios/lib'
@ ./node_modules/axios/index.js 1:0-35 23:4-9 25:0-43:1
@ ./src/main.js 2:0-26 566:8-38 573:8-53 622:41-46 680:26-31 797:47-52 819:49-54 856:29-34 888:21-26 916:22-27 963:22-27 987:22-27 1028:22-27 1069:22-27 1105:22-27 1141:22-27 1165:22-27 1193:22-27 1216:22-27 1256:22-27 1293:22-27 1319:34-39 1333:25-30 1364:22-27 1390:31-36 1426:27-32 1455:24-29 1477:24-29 1496:24-29 1534:31-36 1548:25-30 1587:22-27 1607:22-27 1632:22-27 1660:22-27 1688:22-27 1716:22-27 1747:22-27 1781:22-27 1837:24-29 3262:22-27 3286:22-27 3315:22-27 3333:22-27 3350:22-27 3368:22-27 3386:22-27 3403:24-29 3420:24-29 3437:22-27
ERROR in ./node_modules/axios/lib/axios.js 19:0-57
Module not found: Error: Can't resolve './helpers/HttpStatusCode.js' in '/tmp/build_64aff3bc/node_modules/axios/lib'
@ ./node_modules/axios/index.js 1:0-35 23:4-9 25:0-43:1
@ ./src/main.js 2:0-26 566:8-38 573:8-53 622:41-46 680:26-31 797:47-52 819:49-54 856:29-34 888:21-26 916:22-27 963:22-27 987:22-27 1028:22-27 1069:22-27 1105:22-27 1141:22-27 1165:22-27 1193:22-27 1216:22-27 1256:22-27 1293:22-27 1319:34-39 1333:25-30 1364:22-27 1390:31-36 1426:27-32 1455:24-29 1477:24-29 1496:24-29 1534:31-36 1548:25-30 1587:22-27 1607:22-27 1632:22-27 1660:22-27 1688:22-27 1716:22-27 1747:22-27 1781:22-27 1837:24-29 3262:22-27 3286:22-27 3315:22-27 3333:22-27 3350:22-27 3368:22-27 3386:22-27 3403:24-29 3420:24-29 3437:22-27
ERROR in ./node_modules/axios/lib/core/dispatchRequest.js 8:0-47
Module not found: Error: Can't resolve '../adapters/adapters.js' in '/tmp/build_64aff3bc/node_modules/axios/lib/core'
@ ./node_modules/axios/lib/core/Axios.js 6:0-51 114:21-41 146:16-36
@ ./node_modules/axios/lib/axios.js 5:0-36 29:22-27 30:24-47 33:25-40 50:14-19
@ ./node_modules/axios/index.js 1:0-35 23:4-9 25:0-43:1
@ ./src/main.js 2:0-26 566:8-38 573:8-53 622:41-46 680:26-31 797:47-52 819:49-54 856:29-34 888:21-26 916:22-27 963:22-27 987:22-27 1028:22-27 1069:22-27 1105:22-27 1141:22-27 1165:22-27 1193:22-27 1216:22-27 1256:22-27 1293:22-27 1319:34-39 1333:25-30 1364:22-27 1390:31-36 1426:27-32 1455:24-29 1477:24-29 1496:24-29 1534:31-36 1548:25-30 1587:22-27 1607:22-27 1632:22-27 1660:22-27 1688:22-27 1716:22-27 1747:22-27 1781:22-27 1837:24-29 3262:22-27 3286:22-27 3315:22-27 3333:22-27 3350:22-27 3368:22-27 3386:22-27 3403:24-29 3420:24-29 3437:22-27
ERROR in ./node_modules/axios/lib/platform/browser/index.js 3:0-36
Module not found: Error: Can't resolve './classes/Blob.js' in '/tmp/build_64aff3bc/node_modules/axios/lib/platform/browser'
@ ./node_modules/axios/lib/platform/index.js 1:0-39 6:5-13
@ ./node_modules/axios/lib/defaults/index.js 8:0-44 139:14-39 140:10-31
@ ./node_modules/axios/lib/axios.js 7:0-43 47:29-37
@ ./node_modules/axios/index.js 1:0-35 23:4-9 25:0-43:1
@ ./src/main.js 2:0-26 566:8-38 573:8-53 622:41-46 680:26-31 797:47-52 819:49-54 856:29-34 888:21-26 916:22-27 963:22-27 987:22-27 1028:22-27 1069:22-27 1105:22-27 1141:22-27 1165:22-27 1193:22-27 1216:22-27 1256:22-27 1293:22-27 1319:34-39 1333:25-30 1364:22-27 1390:31-36 1426:27-32 1455:24-29 1477:24-29 1496:24-29 1534:31-36 1548:25-30 1587:22-27 1607:22-27 1632:22-27 1660:22-27 1688:22-27 1716:22-27 1747:22-27 1781:22-27 1837:24-29 3262:22-27 3286:22-27 3315:22-27 3333:22-27 3350:22-27 3368:22-27 3386:22-27 3403:24-29 3420:24-29 3437:22-27
ERROR in ./node_modules/axios/lib/platform/index.js 2:0-43
Module not found: Error: Can't resolve './common/utils.js' in '/tmp/build_64aff3bc/node_modules/axios/lib/platform'
@ ./node_modules/axios/lib/defaults/index.js 8:0-44 139:14-39 140:10-31
@ ./node_modules/axios/lib/axios.js 7:0-43 47:29-37
@ ./node_modules/axios/index.js 1:0-35 23:4-9 25:0-43:1
@ ./src/main.js 2:0-26 566:8-38 573:8-53 622:41-46 680:26-31 797:47-52 819:49-54 856:29-34 888:21-26 916:22-27 963:22-27 987:22-27 1028:22-27 1069:22-27 1105:22-27 1141:22-27 1165:22-27 1193:22-27 1216:22-27 1256:22-27 1293:22-27 1319:34-39 1333:25-30 1364:22-27 1390:31-36 1426:27-32 1455:24-29 1477:24-29 1496:24-29 1534:31-36 1548:25-30 1587:22-27 1607:22-27 1632:22-27 1660:22-27 1688:22-27 1716:22-27 1747:22-27 1781:22-27 1837:24-29 3262:22-27 3286:22-27 3315:22-27 3333:22-27 3350:22-27 3368:22-27 3386:22-27 3403:24-29 3420:24-29 3437:22-27
5 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
webpack 5.89.0 compiled with 5 errors in 11223 ms
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- node_modules checked into source control
https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits
- Node version not specified in package.json
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed

字符串

w8ntj3qf

w8ntj3qf1#

可能已经解决了这个问题。正在从节点模块导入axios以捆绑前端,似乎webpack构建环境是不同的。使用了浏览器的精简axios代码,并将其放置在一个单独的文件中,然后将其导入到将捆绑的文件中。认为这与axios webpack对较新版本的兼容性有关,因为当我使用observability模块时,他们似乎也试图支持较新版本使用1.1.2但当可观测性模块进来时,两者都使用最新版本,同时保持1.1.2。
不确定是什么不同的Heroku环境仍然导致这一点,但使axios一个预先构建的缩小包导入工作。

相关问题