由于未安装webpack CLI,Heroku构建失败-Rails 6



我过去曾成功地将我的应用程序部署到Heroku的生产中,但这是我第一次将我的rails资产转移到webpack中。在开发中一切都很好,但当我尝试部署到Heroku时,我会收到以下错误消息:

remote:        [4/4] Building fresh packages...
remote:        Done in 39.56s.
remote:        Compiling...
remote:        Compilation failed:
remote:        CLI for webpack must be installed.
remote:          webpack-cli (https://github.com/webpack/webpack-cli)
remote:        
remote:        We will use "yarn" to install the CLI via "yarn add -D webpack-cli".
remote:        Do you want to install 'webpack-cli' (yes/no): 
remote: 
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed

我的包中安装了webpackcli,所以我不确定为什么它在部署到Heroku时失败。我还将nodejs-heroku构建包配置为在服务器上的ruby heroku构建包之前构建。

我已经在本地计算机上运行了yarn add -D webpack-cli,以确保安装了webpackcli。

下面是我的package.json文件:

{
"name": "appex",
"private": true,
"dependencies": {
"@popperjs/core": "^2.9.2",
"@rails/actioncable": "^6.0.0",
"@rails/activestorage": "^6.0.0",
"@rails/ujs": "^6.0.0",
"@rails/webpacker": "5.2.1",
"bootstrap": "^5.0.1",
"bootstrap-icons": "^1.5.0",
"file-loader": "^6.2.0",
"jquery": "^3.6.0",
"sass-loader": "^12.0.0",
"turbolinks": "^5.2.0"
},
"version": "0.1.0",
"devDependencies": {
"@babel/core": "^7.14.3",
"@babel/preset-env": "^7.14.2",
"babel-loader": "^8.2.2",
"css-loader": "^5.2.6",
"resolve-url-loader": "^4.0.0",
"style-loader": "^2.0.0",
"webpack": "^5.37.1",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^3.11.2"
}
}

Rails版本6.0.3.4 ruby版本2.6.3

感谢您的帮助!

这里有一些可能有用的东西https://github.com/webpack/webpack/issues/7197

相关内容

  • 没有找到相关文章

最新更新