简体   繁体   中英

“Heroku ”Cannot find module '@babel/runtime/helpers/builtin/interopRequireDefault'

After deploying a node.js container to Heroku I get this error log:

2020-08-30T00:12:15.679723+00:00 app[abb.1]: (node:3) UnhandledPromiseRejectionWarning: Error: Cannot find module '@babel/runtime/helpers/builtin/interopRequireDefault'

2020-08-30T00:12:15.679796+00:00 app[abb.1]: Require stack:

2020-08-30T00:12:15.679804+00:00 app[abb.1]: - /AirbnbBClone-Jeremy/packages/common/node_modules/yup/lib/index.js

2020-08-30T00:12:15.679810+00:00 app[abb.1]: - /AirbnbBClone-Jeremy/packages/common/dist/yupSchemas/user.js

2020-08-30T00:12:15.679811+00:00 app[abb.1]: - /AirbnbBClone-Jeremy/packages/common/dist/index.js

2020-08-30T00:12:15.679815+00:00 app[abb.1]: - /AirbnbBClone-Jeremy/packages/server/dist/modules/user/forgotPassword/resolvers.js

2020-08-30T00:12:15.679815+00:00 app[abb.1]: - /AirbnbBClone-Jeremy/packages/server/dist/utils/genSchema.js

2020-08-30T00:12:15.679815+00:00 app[abb.1]: - /AirbnbBClone-Jeremy/packages/server/dist/startServer.js

2020-08-30T00:12:15.679816+00:00 app[abb.1]: - /AirbnbBClone-Jeremy/packages/server/dist/index.js

2020-08-30T00:12:15.679816+00:00 app[abb.1]:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1080:15)

2020-08-30T00:12:15.679816+00:00 app[abb.1]:     at Function.Module._load (internal/modules/cjs/loader.js:923:27)

2020-08-30T00:12:15.679817+00:00 app[abb.1]:     at Module.require (internal/modules/cjs/loader.js:1140:19)

2020-08-30T00:12:15.679817+00:00 app[abb.1]:     at require (internal/modules/cjs/helpers.js:75:18)

2020-08-30T00:12:15.679821+00:00 app[abb.1]:     at Object.<anonymous> (/AirbnbBClone-Jeremy/packages/common/node_modules/yup/lib/index.js:3:30)

2020-08-30T00:12:15.679821+00:00 app[abb.1]:     at Module._compile (internal/modules/cjs/loader.js:1251:30)

2020-08-30T00:12:15.679822+00:00 app[abb.1]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1272:10)

2020-08-30T00:12:15.679822+00:00 app[abb.1]:     at Module.load (internal/modules/cjs/loader.js:1100:32)

2020-08-30T00:12:15.679822+00:00 app[abb.1]:     at Function.Module._load (internal/modules/cjs/loader.js:962:14)

2020-08-30T00:12:15.679822+00:00 app[abb.1]:     at Module.require (internal/modules/cjs/loader.js:1140:19)

2020-08-30T00:12:15.679823+00:00 app[abb.1]:     at require (internal/modules/cjs/helpers.js:75:18)

2020-08-30T00:12:15.679823+00:00 app[abb.1]:     at Object.<anonymous> (/AirbnbBClone-Jeremy/packages/common/dist/yupSchemas/user.js:3:13)

2020-08-30T00:12:15.679823+00:00 app[abb.1]:     at Module._compile (internal/modules/cjs/loader.js:1251:30)

2020-08-30T00:12:15.679823+00:00 app[abb.1]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1272:10)

2020-08-30T00:12:15.679824+00:00 app[abb.1]:     at Module.load (internal/modules/cjs/loader.js:1100:32)

2020-08-30T00:12:15.679824+00:00 app[abb.1]:     at Function.Module._load (internal/modules/cjs/loader.js:962:14)

2020-08-30T00:12:15.679824+00:00 app[abb.1]: (Use `node --trace-warnings ...` to show where the warning was created)

2020-08-30T00:12:15.680346+00:00 app[abb.1]: (node:3) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

2020-08-30T00:12:15.680403+00:00 app[abb.1]: (node:3) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I heard this problem with Babel could be solved by downgrading Babel to 7.0.0-beta.55, but I cannot find it anywhere in my package.json . Do I need to alter my yarn.lock file to downgrade?

I had this situation before when I deployed a NodeJS application to Heroku. The solution to this is to put @babel/runtime in the dependencies list, not in the devDependencies . Somehow @babel/runtime needs to be shipped along with other core packages. Hope this helpful!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM