1

I'm trying to deploy my react app on Heroku but I keep getting this error:

Module not found: Error: Can't resolve 'react-bootstrap/Carousel' in '/tmp/build_587ed15992b6e42ca234a30b1b616160/src/components'

I found this: Module not found Error when deployed on Heroku ... but this case sensitivity issue doesn't seem to be the problem here since I import the Carousel exactly as recommended by react-bootstrap: https://react-bootstrap.github.io/components/carousel/

This is the first time I am trying to deploy on Heroku and any help is appreciated!

Here is the complete build log:

Enumerating objects: 71, done.
Counting objects: 100% (71/71), done.
Delta compression using up to 8 threads
Compressing objects: 100% (70/70), done.
Writing objects: 100% (71/71), 244.98 KiB | 5.44 MiB/s, done.
Total 71 (delta 27), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Node.js app detected
remote:        
remote: -----> Creating runtime environment
remote:        
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:        NODE_VERBOSE=false
remote:        
remote: -----> Installing binaries
remote:        engines.node (package.json):  12.12.0
remote:        engines.npm (package.json):   6.12.0
remote:        
remote:        Resolving node version 12.12.0...
remote:        Downloading and installing node 12.12.0...
remote:        Bootstrapping npm 6.12.0 (replacing 6.11.3)...
remote:        npm 6.12.0 installed
remote:        
remote: -----> Installing dependencies
remote:        Installing node modules (package.json + package-lock)
remote:        
remote:        > core-js@2.6.9 postinstall /tmp/build_a444525ab5996c219b5538f41fdd646b/node_modules/core-js
remote:        > node scripts/postinstall || echo "ignore"
remote:        
remote:        
remote:        > uglifyjs-webpack-plugin@0.4.6 postinstall /tmp/build_a444525ab5996c219b5538f41fdd646b/node_modules/uglifyjs-webpack-plugin
remote:        > node lib/post_install.js
remote:        
remote:        added 1402 packages from 852 contributors and audited 15016 packages in 31.035s
remote:        found 32 vulnerabilities (29 low, 1 moderate, 2 high)
remote:          run `npm audit fix` to fix them, or `npm audit` for details
remote:        
remote: -----> Build
remote:        Running build
remote:        
remote:        > ecommerce-react-graphql-stripe@0.1.0 build /tmp/build_a444525ab5996c219b5538f41fdd646b
remote:        > react-scripts build
remote:        
remote:        Creating an optimized production build...
remote:        Failed to compile.
remote:        
remote:        Module not found: Error: Can't resolve 'react-bootstrap/Carousel' in '/tmp/build_a444525ab5996c219b5538f41fdd646b/src/components'
remote:        
remote:        
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! ecommerce-react-graphql-stripe@0.1.0 build: `react-scripts build`
remote: npm ERR! Exit status 1
remote: npm ERR! 
remote: npm ERR! Failed at the ecommerce-react-graphql-stripe@0.1.0 build script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote: 
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR!     /tmp/npmcache.j8Q79/_logs/2020-02-16T16_55_24_218Z-debug.log
remote: 
remote: -----> Build failed
remote:        
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:        
remote:        If you're stuck, please submit a ticket so we can help:
remote:        https://help.heroku.com/
remote:        
remote:        Love,
remote:        Heroku
remote:        
remote:  !     Push rejected, failed to compile Node.js app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
philbo920
  • 11
  • 2
  • Hi, welcome to StackOverflow! Did you go through Heroku's [Troubleshooting Node Deploys](https://devcenter.heroku.com/articles/troubleshooting-node-deploys) guide? It's hard to see what could go wrong with only the build output. A reproduction repo could also help! – Robin Métral Feb 19 '20 at 18:50
  • Also, does the local build succeed? (npm run build) – Robin Métral Feb 19 '20 at 18:51
  • npm run build gives me the following error (which I also get while deploying to Heroku when I remove all react-bootstrap imports from the app): Failed to minify the code from this file: ./node_modules/strapi-sdk-javascript/build/main/lib/sdk.js:16 – philbo920 Feb 20 '20 at 18:17
  • And yes I also went trough Herokus Troubleshooting Node Deploys guide. Nothing helped me there... I have never done a reproduction repo before. You mean a GitHub repository with all the basics needed to reproduce the error right? I'll have to think about how to do this without you having to install too many packages.. To give some more context this is a react-app using Graphql, Strapi, Stripe and some other libraries – philbo920 Feb 20 '20 at 18:26
  • And thanks a lot for your help! – philbo920 Feb 20 '20 at 18:26
  • Thanks for the extra info! If the local build fails too, I would focus on it before looking at the Heroku depoy (it might not be related to Heroku itself). Do the build errors persist if you run `rm -rf node_modules && npm install && npm run build`? – Robin Métral Feb 21 '20 at 09:39
  • hey just to let you know i will be on vacation for the next two weeks. I'll get back to this – philbo920 Feb 22 '20 at 13:12
  • Thanks for letting me know! Let's try to figure this out when you get back. Enjoy your holidays :) – Robin Métral Feb 22 '20 at 14:07

0 Answers0