问题描述
我正在研究Rails应用程序。该应用程序运行良好,并且已成功将其多次部署到Heroku。最近,我进行了许多更改,包括添加Tailwindcss以及许多数据库更改。该应用程序可在本地运行,但是当我部署到Heroku时,我会得到:
ERROR in ./app/javascript/packs/application.js
remote: Module build Failed (from ./node_modules/babel-loader/lib/index.js):
remote: Error: Cannot find module '@babel/compat-data/corejs3-shipped-proposals'
深入了解为什么该方法在本地有效但无法部署会有所帮助
解决方法
我在Rails应用程序的CI管道中遇到类似的问题。
每https://github.com/JeffreyWay/laravel-mix/issues/2383#issuecomment-683538859,我做了以下操作来解决我的问题:
- 已将
"@babel/preset-env": "7.9.0"
添加到package.json(到您阅读此书时,该版本可能已过时) - 冉
yarn install --check-files
- 冉
bin/rails webpacker:install
- 冉
bin/rails webpacker:compile