StephenGrider / FullstackReactCode

Companion repo to https://www.udemy.com/node-with-react-fullstack-web-development
1.39k stars 1.17k forks source link

react-scripts: not found while pushing to heroku #14

Closed McZieuwa closed 6 years ago

McZieuwa commented 6 years ago

Hi, please whenever i try to push to heroku using : git push heroku master, I get this error.

Counting objects: 12, done. Delta compression using up to 2 threads. Compressing objects: 100% (12/12), done. Writing objects: 100% (12/12), 31.45 KiB | 0 bytes/s, done. Total 12 (delta 8), 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: NPM_CONFIG_PRODUCTION=true remote: NODE_VERBOSE=false remote: NODE_ENV=production remote: NODE_MODULES_CACHE=true remote: remote: -----> Installing binaries remote: engines.node (package.json): 9.4.0 remote: engines.npm (package.json): 5.6.0 remote:
remote: Resolving node version 9.4.0... remote: Downloading and installing node 9.4.0... remote: npm 5.6.0 already installed with node remote: remote: -----> Restoring cache remote: Loading 2 from cacheDirectories (default): remote: - node_modules remote: - bower_components (not cached - skipping) remote: remote: -----> Building dependencies remote: Installing node modules (package.json + package-lock) remote: added 17 packages in 2.327s remote: Running heroku-postbuild remote:
remote: > scholarlyft@1.0.0 heroku-postbuild /tmp/build_29056fffc5fdcc0026d532b01dc8bfad remote: > NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client remote:
remote: added 18 packages in 3.537s remote:
remote: > client@0.1.0 build /tmp/build_29056fffc5fdcc0026d532b01dc8bfad/client remote: > react-scripts build remote:
remote: sh: 1: react-scripts: not found remote: npm ERR! file sh remote: npm ERR! code ELIFECYCLE remote: npm ERR! errno ENOENT remote: npm ERR! syscall spawn remote: npm ERR! client@0.1.0 build: react-scripts build remote: npm ERR! spawn ENOENT remote: npm ERR! remote: npm ERR! Failed at the client@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! /app/.npm/_logs/2018-01-21T00_28_13_886Z-debug.log remote: npm ERR! code ELIFECYCLE remote: npm ERR! errno 1 remote: npm ERR! scholarlyft@1.0.0 heroku-postbuild: NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client remote: npm ERR! Exit status 1 remote: npm ERR! remote: npm ERR! Failed at the scholarlyft@1.0.0 heroku-postbuild 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! /app/.npm/_logs/2018-01-21T00_28_13_900Z-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 .

here is my package.json file:

{ "name": "scholarlyft", "version": "1.0.0", "description": "An educational website", "main": "index.js", "engines": { "node": "9.4.0", "npm": "5.6.0" }, "scripts": { "start": "node index.js", "server": "nodemon index.js", "client": "npm run start --prefix client", "dev": "concurrently \"npm run server\" \"npm run client\"", "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client" }, "author": "Edward Alozieuwa", "license": "ISC", "dependencies": { "concurrently": "^3.5.1", "express": "^4.16.2" }, "devDependencies": { "nodemon": "^1.14.11" } }

Please help!

McZieuwa commented 6 years ago

moved react-scripts from devDependencies to dependencies in client package.json. That fixed the problem.

gandhiShepard commented 6 years ago

I had to delete the package-lock.json as well

Raxy45 commented 4 years ago

I am facing the same issue. Anyone got any solution ?.

Patelso9 commented 3 years ago

I am getting the same error and my react-scripts are also in dependencies under client/package.json.

Do I need to move nodemon out of devDependencies?

bholanathbarik9748 commented 3 years ago

-----> Building on the Heroku-20 stack -----> Using buildpack: https://github.com/nhutphuongit/create-react-app-buildpack -----> React.js (create-react-app) multi app detected =====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-multi.git =====> Detected Framework: Multipack =====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-nodejs.git =====> Detected Framework: Node.js

-----> Creating runtime environment

   NPM_CONFIG_PRODUCTION=false
   NPM_CONFIG_LOGLEVEL=error
   NODE_VERBOSE=false
   NODE_ENV=development
   NODE_MODULES_CACHE=true

-----> Installing binaries engines.node (package.json): unspecified engines.npm (package.json): unspecified (use default)

   Resolving node version 14.x...
   Downloading and installing node 14.17.3...
   Using default npm version: 6.14.13

-----> Restoring cache

-----> Installing dependencies Installing node modules

   > core-js-pure@3.15.2 postinstall /tmp/build_bc4bc1ad/node_modules/core-js-pure
   > node -e "try{require('./postinstall')}catch(e){}"

   > core-js@2.6.12 postinstall /tmp/build_bc4bc1ad/node_modules/babel-runtime/node_modules/core-js
   > node -e "try{require('./postinstall')}catch(e){}"

   > ejs@2.7.4 postinstall /tmp/build_bc4bc1ad/node_modules/ejs
   > node ./postinstall.js

   > fsevents@1.2.13 install /tmp/build_bc4bc1ad/node_modules/webpack-dev-server/node_modules/fsevents
   > node install.js

   Skipping 'fsevents' build as platform linux is not supported

   > fsevents@1.2.13 install /tmp/build_bc4bc1ad/node_modules/watchpack-chokidar2/node_modules/fsevents
   > node install.js

   Skipping 'fsevents' build as platform linux is not supported

   > core-js@3.15.2 postinstall /tmp/build_bc4bc1ad/node_modules/core-js
   > node -e "try{require('./postinstall')}catch(e){}"

   > core-js@3.6.5 postinstall /tmp/build_bc4bc1ad/node_modules/@firebase/polyfill/node_modules/core-js
   > node -e "try{require('./postinstall')}catch(e){}"

   > protobufjs@6.11.2 postinstall /tmp/build_bc4bc1ad/node_modules/protobufjs
   > node scripts/postinstall

   added 2041 packages in 46.899s

-----> Build Running build

   > demo-1@0.1.0 build /tmp/build_bc4bc1ad
   > react-scripts build

   Creating an optimized production build...
   Failed to compile.

   ./node_modules/bootstrap/dist/js/bootstrap.js
   Cannot find module: '@popperjs/core'. Make sure this package is installed.

   You can install this package by running: npm install @popperjs/core.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! demo-1@0.1.0 build: react-scripts build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the demo-1@0.1.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /tmp/npmcache.bzlw0/_logs/2021-07-18T19_19_43_828Z-debug.log -----> Build failed

   We're sorry this build is failing! You can troubleshoot common issues here:
   https://devcenter.heroku.com/articles/troubleshooting-node-deploys

   Some possible problems:

   - Node version not specified in package.json
     https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

   - A module may be missing from 'dependencies' in package.json
     https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies

   Love,
   Heroku

! Push rejected, failed to compile React.js (create-react-app) multi app. ! Push failed

bholanathbarik9748 commented 3 years ago

I Am getting this error can you plz help me

bholanathbarik9748 commented 3 years ago

I also use https://github.com/mars/create-react-app-buildpack this build-pack best same thing happened here

pratiksingh5 commented 3 years ago

I'm facing this issue. Can anybody tell me how to fix this

thefilmmaking commented 3 years ago

I'm facing this issue. Can anybody tell me how to fix this

Besides moving react-scripts out of devDependencies (as noted above), 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",

NarayanPote commented 2 years ago

I'm getting Same error can anyone tell me how to fix this Error?