I've looked through similar stackoverflow questions and none of them seem to work for me. I've been trying to deploy my NodeJS app to Heroku but keep bumping into this message from heroku regarding bower. I have tried manually writing bower in my dependencies but that has not worked, I also tried moving my dependencies from bower.json to package.json but that also didn't work. Thank you guy so much, I have put my heroku logs, package.json, and bower.json files below.
angular-seed#0.0.0 postinstall /tmp/build_370f51a52877a36d300c739f31855511
remote: > bower install
remote:
remote: sh: 1: bower: not found
I have listed below my package.json and my bower.json files.
Package.json
"name": "angular-seed",
"private": true,
"version": "0.0.0",
"description": "A starter project for AngularJS",
"repository": "https://github.com/angular/angular-seed",
"license": "MIT",
"devDependencies": {
"bower": "^1.7.7",
"http-server": "^0.9.0",
"jasmine-core": "^2.4.1",
"karma": "^0.13.22",
"karma-chrome-launcher": "^0.2.3",
"karma-firefox-launcher": "^0.1.7",
"karma-jasmine": "^0.3.8",
"karma-junit-reporter": "^0.4.1",
"protractor": "^3.2.2"
},
"scripts": {
"postinstall": "bower install",
"prestart": "npm install",
"start": "http-server -a localhost -p 8000 -c-1 ./app",
"pretest": "npm install",
"test": "karma start karma.conf.js",
"test-single-run": "karma start karma.conf.js --single-run",
"preupdate-webdriver": "npm install",
"update-webdriver": "webdriver-manager update",
"preprotractor": "npm run update-webdriver",
"protractor": "protractor e2e-tests/protractor.conf.js",
},
"dependencies":{
"bower": "^1.7.9"
}
}
Bower.json
{
"name": "angular-seed",
"description": "A starter project for AngularJS",
"version": "0.0.0",
"homepage": "https://github.com/angular/angular-seed",
"license": "MIT",
"private": true,
"dependencies": {
"angular": "~1.5.0",
"angular-route": "~1.5.0",
"angular-loader": "~1.5.0",
"angular-mocks": "~1.5.0",
"html5-boilerplate": "^5.3.0"
}
}
Heroku
remote: -----> Creating runtime environment
remote: NPM_CONFIG_LOGLEVEL=error
remote: NPM_CONFIG_PRODUCTION=true
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote: Resolving node version (latest stable) via semver.io...
remote: Downloading and installing node 5.11.1...
remote: Using default npm version: 3.8.6
remote: -----> Restoring cache
remote: Skipping cache restore (new runtime signature)
remote: -----> Building dependencies
remote: Installing node modules (package.json)
remote: > angular-seed#0.0.0 postinstall /tmp/build_73e84e8327fb8bcb9b0e1cdc47631bca
remote: > bower install
remote: sh: 1: bower: not found
remote: npm ERR! Linux 3.13.0-95-generic
remote: npm ERR! argv
/tmp/build_73e84e8327fb8bcb9b0e1cdc47631bca/.heroku/node/bin/node" "/tmp/build_73e84e8327fb8bcb9b0e1cdc47631bca/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_73e84e8327fb8bcb9b0e1cdc47631bca/.npmrc"
remote: npm ERR! node v5.11.1
remote: npm ERR! npm v3.8.6
remote: npm ERR! file sh
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno ENOENT
remote: npm ERR! syscall spawn
remote: npm ERR! angular-seed#0.0.0 postinstall: `bower install`
remote: npm ERR! spawn ENOENT
remote: npm ERR!
remote: npm ERR! Failed at the angular-seed#0.0.0 postinstall script
bower install'.
remote: npm ERR! Make sure you have the latest version of node.js and npm installed.
remote: npm ERR! If you do, this is most likely a problem with the angular-seed package,
remote: npm ERR! not with npm itself.
remote: npm ERR! Tell the author that this fails on your system:
remote: npm ERR! bower install
remote: npm ERR! You can get information on how to open an issue for this project with
remote: npm ERR! npm bugs angular-seed
remote: npm ERR! Or if that isn't available, you can get their info via:
remote: npm ERR! npm owner ls angular-seed
remote: npm ERR! There is likely additional logging output above.
remote: npm ERR! Please include the following file with any support
remote: npm ERR! /tmp/build_73e84e8327fb8bcb9b0e1cdc47631bca/npm-debug.log
remote: -----> Build failed
Try this instead for the postinstall:
"postinstall": "./node_modules/bower/bin/bower install"
This is because bower is installed locally in the specified path, not globally.
Related
Next.js App, all work fine on localhost, when I push to Heroku, Push rejected, idk why. Please help my heroes.
Heroku Push logs:
remote: -----> Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote:
remote: Resolving node version 18.x...
remote: Downloading and installing node 18.12.1...
remote: Using default npm version: 8.19.2
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote: npm ERR! code ERESOLVE
remote: npm ERR! ERESOLVE could not resolve
remote: npm ERR!
remote: npm ERR! While resolving: react-lightgallery#0.9.0
remote: npm ERR! Found: react#18.2.0
remote: npm ERR! node_modules/react
remote: npm ERR! react#"^18.2.0" from the root project
remote: npm ERR! peer react#"^17.0.2 || ^18.0.0-0" from next#12.2.6
remote: npm ERR! node_modules/next
remote: npm ERR! next#"12.2" from the root project
remote: npm ERR! 9 more (react-circular-progressbar, react-dom, react-modal, ...)
remote: npm ERR!
remote: npm ERR! Could not resolve dependency:
remote: npm ERR! peer react#"^16.13.1" from react-lightgallery#0.9.0
remote: npm ERR! node_modules/react-lightgallery
remote: npm ERR! react-lightgallery#"^0.9.0" from the root project
remote: npm ERR!
remote: npm ERR! Conflicting peer dependency: react#16.14.0
remote: npm ERR! node_modules/react
remote: npm ERR! peer react#"^16.13.1" from react-lightgallery#0.9.0
remote: npm ERR! node_modules/react-lightgallery
remote: npm ERR! react-lightgallery#"^0.9.0" from the root project
remote: npm ERR!
remote: npm ERR! Fix the upstream dependency conflict, or retry
remote: npm ERR! this command with --force, or --legacy-peer-deps
remote: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
remote: npm ERR!
remote: npm ERR! See /tmp/npmcache.WP8R2/eresolve-report.txt for a full report.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.WP8R2/_logs/2022-12-16T21_23_22_466Z-debug-0.log
remote:
remote: -----> Build failed
package.json:
{
"name": "test-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start -p $PORT",
"lint": "next lint"
},
"dependencies": {
"isotope-layout": "^3.0.6",
"next": "12.2",
"particles.js": "^2.0.0",
"react": "^18.2.0",
"react-circular-progressbar": "^2.1.0",
"react-dom": "^18.2.0",
"react-lightgallery": "^0.9.0",
"react-modal": "^3.15.1",
"react-modal-video": "^1.2.10",
"react-tabs": "^5.1.0",
"react-type-animation": "^1.1.3",
"react-water-wave": "^2.0.1",
"swiper": "^8.3.2"
},
"devDependencies": {
"eslint": "8.23.0",
"eslint-config-next": "12.2.5"
}
}
Next.js, all work fine on localhost, when I push to Heroku, Push rejected, idk why. Please help my heroes.
Thanks for your help.
Push Next.js app to Heroku, Push rejected.
Heroku errors:
Total 13 (delta 9), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 16.x
remote: engines.npm (package.json): unspecified (use default)
remote: Resolving node version 16.x...
remote: Downloading and installing node 16.16.0...
remote: Using default npm version: 8.11.0
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote: npm ERR! code ERESOLVE
remote: npm ERR! ERESOLVE could not resolve
remote: npm ERR! While resolving: #reach/combobox#0.16.5
remote: npm ERR! Found: react#18.2.0
remote: npm ERR! node_modules/react
remote: npm ERR! react#"^18.2.0" from the root project
remote: npm ERR! peer react#"^16.8 || ^17 || ^18" from #react-google-maps/api#2.12.0
remote: npm ERR! node_modules/#react-google-maps/api
remote: npm ERR! #react-google-maps/api#"^2.12.0" from the root project
remote: npm ERR! 9 more (#testing-library/react, react-avatar, react-dom, ...)
remote: npm ERR! Could not resolve dependency:
remote: npm ERR! peer react#"^16.8.0 || 17.x" from #reach/combobox#0.16.5
remote: npm ERR! node_modules/#reach/combobox
remote: npm ERR! #reach/combobox#"^0.16.5" from the root project
remote: npm ERR!
remote: npm ERR! Conflicting peer dependency: react#17.0.2
remote: npm ERR! node_modules/react
remote: npm ERR! peer react#"^16.8.0 || 17.x" from #reach/combobox#0.16.5
remote: npm ERR! node_modules/#reach/combobox
remote: npm ERR! #reach/combobox#"^0.16.5" from the root project
I am trying to deploy this react mern-stack app to heroku for class, which uses certain google map api and dependencies. I tried --legacy-peer-deps and even --force (force completely broke my code), tried almost everything. Nothing seems to be working. Been trying at this for a while now and am completely blocked. I don't know what else to do. I appreciate any insight to this.
Heres my package.json
{
"name": "find-furry-friends",
"version": "0.1.0",
"engines": {
"node": "16.x"
},
"private": true,
"dependencies": {
"#hookform/resolvers": "^2.9.4",
"#reach/combobox": "^0.16.5",
"#react-google-maps/api": "^2.12.0",
"#testing-library/jest-dom": "^5.16.4",
"#testing-library/react": "^13.3.0",
"#testing-library/user-event": "^13.5.0",
"bcrypt": "^5.0.1",
"bootstrap": "^5.1.3",
"dotenv": "^16.0.1",
"express": "^4.18.1",
"jsonwebtoken": "^8.5.1",
"moment": "^2.29.4",
"mongoose": "^6.4.0",
"morgan": "^1.10.0",
"petfinder-client": "^1.0.2",
"react": "^18.2.0",
"react-avatar": "^5.0.1",
"react-dom": "^18.0.2",
"react-file-base64": "^1.0.3",
"react-router-dom": "^6.3.0",
"react-scripts": "^5.0.1",
"react-tilty": "^2.0.3",
"serve-favicon": "^2.5.0",
"use-places-autocomplete": "^4.0.0",
"web-vitals": "^2.1.4",
"yup": "^0.32.11"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"proxy": "http://localhost:3001"
}
The problem is that #reach/combobox wants an older version of React (either 16 0r 17) but you have React 18.2.0 installed at the top level of your package.json. Try downgrading React to version 17:
npm install react#17
Then push to Heroku again.
I'm stuck at deploying my reactJS web application to Heroku.
It worked fine on the local machine. I got problems with permission when Build section runs.
I don't know what did I wrong, everything else in this course works fine.
I tried to deploy the app with GitHub connection, but I got the same error.
I tried to run this code in terminal NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client, but I got another error (NPM... is not a command).
my package.json file :
{
"name": "contactkeeper",
"version": "1.0.0",
"description": "Contact manager app",
"main": "server.js",
"engines": {
"node": "^12.4.0"
},
"scripts": {
"start": "node server.js",
"server": "nodemon server.js",
"client": "npm start --prefix client",
"clientinstall": "npm install --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"
},
"keywords": [],
"author": "vinogitz",
"license": "ISC",
"dependencies": {
"bcryptjs": "^2.4.3",
"config": "^3.1.0",
"express": "^4.17.1",
"express-validator": "^6.1.1",
"jsonwebtoken": "^8.5.1",
"lodash.template": "^4.5.0",
"mongoose": "^5.6.3"
},
"devDependencies": {
"concurrently": "^4.1.1",
"nodemon": "^1.19.1"
}
}
my gitignore like this:
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
#client/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
-----> Build
Running heroku-postbuild
> contactkeeper#1.0.0 heroku-postbuild /tmp/build_5e4bd7bd79fb3c0f84bb21cb820d7594
> NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
audited 902208 packages in 13.316s
found 0 vulnerabilities
> client#0.1.0 build /tmp/build_5e4bd7bd79fb3c0f84bb21cb820d7594/client
> react-scripts build
sh: 1: react-scripts: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! client#0.1.0 build: `react-scripts build`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the client#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.BWDxV/_logs/2019-07-22T11_55_03_878Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! contactkeeper#1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the contactkeeper#1.0.0 heroku-postbuild 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.BWDxV/_logs/2019-07-22T11_55_03_893Z-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
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
I found the problem. the permission denied is not the perfect error message, but i found the solution.
I tried to ignore the node_modules folder in my client folder with .gitignore, but I didn't find the solution first time, so I just delete the sub folder node_modules from project. After that, I tried to deploy it again, and it's worked. So the real problem was that, the git add, git commit, git push commands pushed the node_modules sub folder to the repository.
PS.: The solution is: write node_modules/ instead of /node_modules in gitignore. With this the node_modules folders in a project (root folder or in a sub folder get untracked.)
Thanks!
So I tried to deploy my app to Heroku and find this error Module not found: Error: Can't resolve './components/add-credentials/AddEducation' in '/tmp/build_6b46c3e828c5afc20e70a4b1b2232f69/client/src'
Everything works fine including that module in localhost. What should I change for this to work?
Complete Build Log
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 8.11.x
engines.npm (package.json): 5.6.x
engines.yarn (package.json): 1.9.x
Resolving node version 8.11.x...
Downloading and installing node 8.11.4...
Bootstrapping npm 5.6.x (replacing 5.6.0)...
npm 5.6.x installed
Resolving yarn version 1.9.x...
Downloading and installing yarn (1.9.4)...
Installed yarn 1.9.4
-----> Building dependencies
Installing node modules (yarn.lock)
yarn install v1.9.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents#1.2.4: The platform "linux" is incompatible with this module.
info "fsevents#1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 13.99s.
Running heroku-postbuild (yarn)
yarn run v1.9.4
$ NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
> uglifyjs-webpack-plugin#0.4.6 postinstall /tmp/build_6b46c3e828c5afc20e70a4b1b2232f69/client/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js
added 1546 packages in 41.748s
> client#0.1.0 build /tmp/build_6b46c3e828c5afc20e70a4b1b2232f69/client
> react-scripts build
Creating an optimized production build...
Failed to compile.
Module not found: Error: Can't resolve './components/add-credentials/AddEducation' in '/tmp/build_6b46c3e828c5afc20e70a4b1b2232f69/client/src'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client#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.te6Qt/_logs/2018-09-14T23_46_37_674Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
Package.json
{
"name": "devconnector",
"version": "1.0.0",
"description": "Social network for developers",
"engines": {
"node": "8.11.x",
"npm": "5.6.x",
"yarn": "1.9.x"
},
"main": "server.js",
"scripts": {
"client-install": "npm install --prefix client",
"start": "node server.js",
"server": "nodemon server.js",
"client": "npm 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": "Dian Yuanda",
"license": "MIT",
"dependencies": {
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.2",
"concurrently": "^4.0.1",
"create-react-app": "^1.5.2",
"express": "^4.16.3",
"global": "^4.3.2",
"gravatar": "^1.6.0",
"jsonwebtoken": "^8.2.0",
"mongoose": "^5.0.12",
"passport": "^0.4.0",
"passport-jwt": "^4.0.0",
"validator": "^9.4.1"
},
"devDependencies": {
"nodemon": "^1.17.5"
}
}
This is the error that I got. It says run the npm bugs reminderpro. I did that but nothing works. My code has sfcookies from npm. When i deployed earlier it said that sfcookies did not download.... something like that. So i tried typing sfcookies on package.json under dependencies but that did not work too. Now is there a SPECIFIC way to put these on heroku, am i missing somehting. (I used create-react-app for initial installation)
remote: npm ERR! Linux 3.13.0-128-generic
remote: npm ERR! argv "/tmp/build_d018c5494b246e95e5185c9297b315ce/.heroku/node/ bin/node" "/tmp/build_d018c5494b246e95e5185c9297b315ce/.heroku/node/bin/npm" "ru n" "build"
remote: npm ERR! node v6.11.3
remote: npm ERR! npm v3.10.10
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! reminderpro#0.1.0 build: `react-scripts build`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the reminderpro#0.1.0 build script 'react-scripts bui ld'.
remote: npm ERR! Make sure you have the latest version of node.js and npm instal led.
remote: npm ERR! If you do, this is most likely a problem with the reminderpro p ackage,
remote: npm ERR! not with npm itself.
remote: npm ERR! Tell the author that this fails on your system:
remote: npm ERR! react-scripts build
remote: npm ERR! You can get information on how to open an issue for this projec t with:
remote: npm ERR! npm bugs reminderpro
remote: npm ERR! Or if that isn't available, you can get their info via:
remote: npm ERR! npm owner ls reminderpro
remote: npm ERR! There is likely additional logging output above.
remote:
remote: npm ERR! Please include the following file with any support request:
remote: npm ERR! /tmp/build_d018c5494b246e95e5185c9297b315ce/npm-debug.log
remote: ! Push rejected, failed to compile React.js (create-react-app) mult i app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to sheltered-plateau-76958.
This is my package.json:
{
"name": "reminderpro",
"version": "0.1.0",
"private": true,
"dependencies": {
"moment": "^2.18.1",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-redux": "^5.0.6",
"react-scripts": "1.0.13",
"redux": "^3.7.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
Is the build script being called before the install?
You should show the code for your package.json as I could better get a grasp of the order Heroku calls your scripts.