【发布时间】:2021-11-04 07:45:38
【问题描述】:
我试图在 heroku 上部署我的 reactjs rails 应用程序。
在我收到此错误之前一切似乎都很好:
Module build failed (from ./node_modules/babel-loader/lib/index.js):
remote: Error: Cannot find module '@babel/preset-react'
该应用程序在我的本地主机中运行良好。我尝试删除我的 node_modules 文件夹,然后运行 npm install 但错误仍然存在(仅在部署 heroku 时)。
我的 package.json:
{
"name": "App",
"private": true,
"dependencies": {
"@rails/webpacker": "5.4.0",
"@types/react": "^17.0.18",
"@types/react-dom": "^17.0.9",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react_ujs": "^2.6.1",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12"
},
"devDependencies": {
"@babel/plugin-syntax-jsx": "^7.14.5",
"@babel/plugin-transform-react-jsx": "^7.14.9",
"@babel/preset-env": "^7.15.0",
"@babel/preset-react": "^7.14.5",
"webpack-dev-server": "^3.11.2"
}
}
【问题讨论】:
标签: reactjs ruby-on-rails heroku