Heroku ReactJS - getting an error while deploying [duplicate] - javascript

This question already has answers here:
What does npm install --legacy-peer-deps do exactly? When is it recommended / What's a potential use case?
(7 answers)
How to use npm install without the --legacy-peer-deps flag to resolve a conflicting peer dependency?
(2 answers)
Why use peer dependencies in npm for plugins?
(3 answers)
Closed 4 months ago.
I'm attempting to deploy from Github my project, but I run into errors, which are related to the installation of the modules.
I have ran into some questions about the topic, and I attempted adding to the package.json file the following lines:
"engines": {
"node": "<=14.x.x",
"npm": "<=6.x.x"
}
But still, when I try to click 'Deploy', I get the following error:
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_PRODUCTION=false
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 18.x...
Downloading and installing node 18.12.1...
Using default npm version: 8.19.2
-----> Restoring cache
Cached directories were not restored due to a change in version of node, npm, yarn or stack
Module installation may take longer for this build
-----> Installing dependencies
Installing node modules
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: #material-ui/core#4.12.4
npm ERR! Found: react#18.2.0
npm ERR! node_modules/react
npm ERR! react#"^18.2.0" from the root project
npm ERR! peer react#">=16.8.0" from #emotion/react#11.10.4
npm ERR! node_modules/#emotion/react
npm ERR! #emotion/react#"^11.10.4" from the root project
npm ERR! peer #emotion/react#"^11.0.0-rc.0" from #emotion/styled#11.10.4
npm ERR! node_modules/#emotion/styled
npm ERR! #emotion/styled#"^11.10.4" from the root project
npm ERR! 3 more (#mui/material, #mui/styled-engine, #mui/system)
npm ERR! 3 more (#mui/material, #mui/styled-engine, #mui/system)
npm ERR! 15 more (#emotion/styled, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.8.0 || ^17.0.0" from #material-ui/core#4.12.4
npm ERR! node_modules/#material-ui/core
npm ERR! #material-ui/core#"^4.12.4" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react#17.0.2
npm ERR! node_modules/react
npm ERR! peer react#"^16.8.0 || ^17.0.0" from #material-ui/core#4.12.4
npm ERR! node_modules/#material-ui/core
npm ERR! #material-ui/core#"^4.12.4" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /tmp/npmcache.q24sn/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.q24sn/_logs/2022-11-07T15_01_32_484Z-debug-0.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
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
Did anyone run across this issue?
The only hint I have is that when I needed to install modules of material-ui in my project by using npm install, I had to add the following flags:
--legacy-peer-deps
how can I choose the commands Heroku will run on Deploy, so I can add the --legacy-peer-deps in order to check whether that's the issue or not? Is it possible to do such thing?
I will just emphasize that I'm speaking about Heroku's deployment, not me installing it through my Terminal locally.
Thanks for any attempt to help!

Related

npm ERR! ERESOLVE unable to resolve dependency tree ReactJS

Im trying to install #tsamantanis/react-glassmorphism in my project.
npm install --save #tsamantanis/react-glassmorphism
and i see this
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: cpprojectmovie#0.1.0
npm ERR! Found: react#18.2.0
npm ERR! node_modules/react
npm ERR! react#"^18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^17.0.1" from #tsamantanis/react-glassmorphism#1.1.2
npm ERR! node_modules/#tsamantanis/react-glassmorphism
npm ERR! #tsamantanis/react-glassmorphism#"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\mintam\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\mintam\AppData\Local\npm-cache\_logs\2022-09-22T03_24_18_239Z-debug-0.log
please help me to find the solution. thank you in advance
The punchline is this:
npm ERR! peer react#"^17.0.1" from #tsamantanis/react-glassmorphism#1.1.2
Peer dependency means the package you're trying to install expects the "peer" (in this case react#"^17.0.1 package) to be in the same project.
This means the package you're trying to install react-glassmorphism's latest version 1.1.2 expects your React version to be at least v17.
The solution is either upgrading your project's React version to v17, or installing an older version of react-glassmorphism package.
Look at the version history of the package and find the version that supports earlier version of React and install it:
npm i --save react-glassmorphism#<version here>

How to install Swagger in Nestjs?

i can't install swagger in my nestjs application. When I try, I get a Error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: test.api#0.0.1
npm ERR! Found: #nestjs/common#8.4.7
npm ERR! node_modules/#nestjs/common
npm ERR! #nestjs/common#"^8.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #nestjs/common#"^9.0.0" from #nestjs/swagger#6.0.1
npm ERR! node_modules/#nestjs/swagger
npm ERR! dev #nestjs/swagger#"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\Jakub\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Jakub\AppData\Local\npm- cache\_logs\2022-07-10T11_03_48_876Z-debug-0.log
How to resolve this?
NestJS 9 was recently released (2 days ago).
https://trilon.io/blog/nestjs-9-is-now-available.
Changes have been made to the #nestjs/swagger package. You are installing the latest version which has peer dependencies on NestJS 9 while your project is still on version 8.4.7.
The error is saying it cannot resolve the requested peer dependency #nestjs/common#^9.0.0. It does find #nestjs/common#8.4.7 instead, but that's not compatible.
Either upgrade NestJS or install an older version of the #nestjs/swagger package that is compatible with the NestJS version your application uses. Version 5.2.1 should work for you.
yarn add #nestjs/swagger#5.2.1
OR
npm i #nestjs/swagger#5.2.1

Error while installing node module in ReactJs

I just cloned a React application from Git that doesn't have node_modules on it. I try to install with command npm install but unable to do it. Following error occurs when installing the npm.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: fuse-react-app#2.0.0
npm ERR! Found: date-fns#2.0.0-alpha.26
npm ERR! node_modules/date-fns
npm ERR! date-fns#"2.0.0-alpha.26" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer date-fns#"2.0.0-alpha.21" from #date-io/date-fns#1.0.1
npm ERR! node_modules/#date-io/date-fns
npm ERR! #date-io/date-fns#"1.0.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\...\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\...\AppData\Local\npm-cache\_logs\2022-04-24T12_44_19_589Z-debug-0.log
I even tried with npm install --legacy-peer-deps but doesn't work. How can I fix this issue?
TL;DR
A possible solution to this problem is setting the version of date-fns to 2.0.0-alpha.21.
Full Answer
To fix your issue, you can change the version of date-fns.
To do this, follow these steps.
In package.json, edit the version of date-fns with the following:
{
"dependencies": {
"date-fns": "2.0.0-alpha.21"
}
}
Save the package.json file, and run the following command in the same directory as package.json.
$ npm install
Your dependencies should install successfully.
Conclusion
In conclusion, you need to change the version of date-fns to 2.0.0-alpha.21.

Could not resolve dependency

I have been trying to download a template to start customizing it. Upon downloading it, one is supposed to install all local dependencies using npm install or yarn install. I have done both of those and I have gotten the same error both times. Moreover I have tried using the same command with --force and --legacy-peer-deps, as advised in the error message. I found a GitHub issue discussing this precise problem and some other stack overflow threads. I have tried everything I have come across, and it is just not working. Moreover I have installed the recommended version of node, so that is not the problem either, as suggested in a different thread.
The error message can be seen below.
While resolving: #mui/material#5.2.0
npm ERR! Found: #emotion/react#11.4.1
npm ERR! node_modules/#emotion/react
npm ERR! #emotion/react#"11.4.1" from the root project
npm ERR! peer #emotion/react#"^11.0.0-rc.0" from #emotion/styled#11.3.0
npm ERR! node_modules/#emotion/styled
npm ERR! #emotion/styled#"11.3.0" from the root project
npm ERR! peerOptional #emotion/styled#"^11.3.0" from #mui/material#5.2.0
npm ERR! node_modules/#mui/material
npm ERR! #mui/material#"5.2.0" from the root project
npm ERR! 1 more (#mui/icons-material)
npm ERR! 1 more (#mui/styled-engine)
npm ERR! 1 more (#mui/styled-engine)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional #emotion/react#"^11.5.0" from #mui/material#5.2.0
npm ERR! node_modules/#mui/material
npm ERR! #mui/material#"5.2.0" from the root project
npm ERR! peer #mui/material#"^5.0.0" from #mui/icons-material#5.2.0
npm ERR! node_modules/#mui/icons-material
npm ERR! #mui/icons-material#"5.2.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: #emotion/react#11.7.1
npm ERR! node_modules/#emotion/react
npm ERR! peerOptional #emotion/react#"^11.5.0" from #mui/material#5.2.0
npm ERR! node_modules/#mui/material
npm ERR! #mui/material#"5.2.0" from the root project
npm ERR! peer #mui/material#"^5.0.0" from #mui/icons-material#5.2.0
npm ERR! node_modules/#mui/icons-material
npm ERR! #mui/icons-material#"5.2.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
The template: https://www.creative-tim.com/product/material-dashboard-react?ref=readme-mdr#
GitHub issue: https://github.com/creativetimofficial/material-dashboard-react/issues/171
Thanks in advance.
The problem is that the specific version of #emotion/react used in the template, is not working anymore.
To solve the problem I went to the package.json and changed the version from 11.4.1 to 11.5.0 manually. Seems that the 11.5.0 solves the problem with the template used.
upgrade your version from package.json file and run again "npm install" command
I received this error while not in the folder of my react app. Cd into it and should be good but I am positive you found this answer by now or stumbled upon it like me. Best wishes

Deployment build issues

Attempting to deploy a MEANJS to Cloud Foundry with Bluemix. The build keeps failing and I can't figure out how to resolve the dependencies. Any suggestions?
Here is the console log:
Starting app mean in org ...
-----> Downloaded app package (86M)
-----> Downloaded app buildpack cache (43M)
-----> IBM SDK for Node.js Buildpack v3.7-20160826-1101
Based on Cloud Foundry Node.js Buildpack v1.5.18
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_ENV=cloud-foundry
NODE_MODULES_CACHE=true
npm scripts will see NODE_ENV=production (not 'cloud-foundry')
https://docs.npmjs.com/misc/config#production
-----> Installing binaries
engines.node (package.json): >=0.12.0
engines.npm (package.json): >=2.0.0
Resolving node version >=0.12.0 via 'node-version-resolver'
Installing IBM SDK for Node.js (4.5.0) from cache
Resolving npm version >=2.0.0 via semver.io...
Downloading and installing npm 3.10.7 (replacing version 2.15.9)...
-----> Restoring cache
Loading 2 from cacheDirectories (default):
- node_modules (exists - skipping)
- bower_components (not cached - skipping)
-----> Checking and configuring service extensions before installing dependencies
-----> Building dependencies
Prebuild detected (node_modules already exists)
> v8-debug#0.7.7 preinstall /tmp/staged/app/node_modules/v8-debug
> node -e 'process.exit(0)'
> node-pre-gyp install --fallback-to-build
sh: 1: node-pre-gyp: not found
npm ERR! Linux 3.19.0-33-generic
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! spawn ENOENT
npm ERR! Failed at the v8-debug#0.7.7 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! argv "/tmp/staged/app/vendor/node/bin/node" "/tmp/staged/app/vendor/node/bin/npm" "rebuild" "--nodedir=/tmp/staged/app/vendor/node"
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! v8-debug#0.7.7 install: `node-pre-gyp install --fallback-to-build`
npm ERR!
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! not with npm itself.
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! npm bugs v8-debug
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls v8-debug
npm ERR! node v4.5.0
npm ERR! npm v3.10.7
npm ERR! If you do, this is most likely a problem with the v8-debug package,
npm ERR! Tell the author that this fails on your system:
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /tmp/staged/app/npm-debug.log
-----> Build failed
Some possible problems:
- node_modules checked into source control
http://docs.cloudfoundry.org/buildpacks/node/node-tips.html
- Dangerous semver range (>) in engines.node
docs.cloudfoundry.org/buildpacks/node/node-tips.html
Staging failed: Buildpack compilation step failed
FAILED
Error restarting application: BuildpackCompileFailed
TIP: use 'cf logs mean --recent' for more information

Categories

Resources