简体   繁体   中英

Can't Figure Out How to Deploy MERN Stack Application to Render. sh: 1: react-scripts: not found Error

Previous Heroku Free Tier user here. I'm forced to try other deployment options due to Heroku removing their Free Tier a few months back. I've deployed a few MERN stack applications to Heroku in the past, but I'm having trouble figuring out how to deploy to render.com . Currently I have my app I'm trying to deploy ( here ) working perfectly in my local environment, but the build fails when I try deploying to Render as a Web Service. The error I get is the following:

Jan 17 11:38:15 PM  > wheres_waldo@0.1.0 build /opt/render/project/src
Jan 17 11:38:15 PM  > react-scripts build
Jan 17 11:38:15 PM  
Jan 17 11:38:15 PM  sh: 1: react-scripts: not found

In my package.json I clearly have "react-scripts": "^5.0.1" in the dependencies so I do not understand why the error happens here. I try changing the 'start' and 'build' scripts in package.json to other commands like 'npm run build' or 'npm start' but no luck. I cannot find any good documents on MERN stack deployment either for Render. Is there a way of making this work or should I try another free option elsewhere that provides better support for my stack?

Besides moving react-scripts out of devDependencies, try changing your node version in your server side package.json in the "engines" section to the following (instead of having a specific version selected): "node": "^8 || ^10",

https://github.com/StephenGrider/FullstackReactCode/issues/14#issuecomment-928936921

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