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
Related
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!
I tried npx create-react-app my-app and here's the error:
(ps: I tried npm init npm install create-react-app and then the cmd showed above. got the same err) HELP!
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code 1
npm ERR! path /Users/atomxv/Desktop/my-app/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! SOLINK_MODULE(target) Release/canvas-postbuild.node
npm ERR! CXX(target) Release/obj.target/canvas/src/backend/Backend.o
npm ERR! CXX(target) Release/obj.target/canvas/src/backend/ImageBackend.o
npm ERR! CXX(target) Release/obj.target/canvas/src/backend/PdfBackend.o
npm ERR! ../src/backend/Backend.cc:111:10: warning: address of stack memory associated with local variable 'msg' returned [-Wreturn-stack-address]
npm ERR! return msg.c_str();
npm ERR! ^~~
npm ERR! 1 warning generated.
You’ll need to have Node >= 10 on your local development machine. Also you dont have to do npm init npm install create-react-app
I transferred a ReactJS + NodeJS project from another computer to a new computer. Then inside the folder, I did npm install in the terminal but getting the following response back.
> fsevents#1.0.14 install /Users/Joshua/Projects/practice_project/node_modules/fsevents
> node-pre-gyp install --fallback-to-build
[fsevents] Success: "/Users/Joshua/Projects/practice_project/node_modules/fsevents/lib/binding/Release/node-v46-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
And on the previous computer, I ran the project via npm run server, but when I do it after npm run server in the project on the new computer, now I am getting:
> practice_project#1.0.0 serve /Users/Joshua/Projects/practice_project
> nodemon server/server.js --ignore components
sh: nodemon: command not found
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "serve"
npm ERR! node v4.6.1
npm ERR! npm v2.15.9
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! practice_project#1.0.0 serve: `nodemon server/server.js --ignore components`
npm ERR! spawn ENOENT
I looked around but can't seem to find the right solution. Tried npm install -g node-gyp but getting tar.unpack untar error.
What could be the issue? Will upvote and accept the answer. Thank you.
In this case, the first message you received is just telling you it's attempting to rebuild the fsevents package for your environment, then realized it already had it built, so stopped the process.
The second message is indicating that you are attempting to run nodemon but it isn't installed. I would hazard a guess that it was installed globally on your previous machine (and therefore not included in the project's package.json). If you want to install it globally again, you'll need to run npm i -g nodemon.
I'm setting up a Meanjs instance with a Yeoman generator. When I do 'sudo yo meanjs' everything works fine until it looks like it is trying to make a directory and it fails, any ideas on what is going on here?
SOLINK_MODULE(target) Release/kerberos.node: Finished
> bson#0.2.5 install /Users/xxx/Documents/mean/node_modules/connect-
mongo/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/bson/ext/bson.o
SOLINK_MODULE(target) Release/bson.node
SOLINK_MODULE(target) Release/bson.node: Finished
npm ERR! Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15'
npm ERR! { [Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/xxx/.npm/uglify-js/2.4.15',
npm ERR! parent: 'grunt-contrib-uglify' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/xxx/Documents/mean
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! path /Users/xxx/.npm/uglify-js/2.4.15
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15'
npm ERR! not ok code 0
That is a pretty common error.
Yeoman is running the following:
bower install & npm install
Bower install succeeded, however NPM install is failing because of user permissions. Just run:
sudo npm install
The ZenCoder's answer is spot on, but if you want to permanently fix this permissions error, you can follow the tutorial at: https://docs.npmjs.com/getting-started/fixing-npm-permissions
Since you're on a Mac, you could actually avoid npm permissions errors altogether by just installing node instead via homebrew:
brew install node (this will install npm too)
Homebrew installs programs to a directory that doesn't require sudo for write, so you can npm install -g <whatever> freely without it.
I'm trying to install a nodejs application in heroku but can not be deployed, because node-gyp rebuild of the base64 library. Any idea to solve this deploy issue.
Works ok locally, the issue is only deploying into heroku. Any ideas to solve it?
Gizras-iMac:negawatt-iec-scraper gizra$ git push heroku master
Fetching repository, done.
Counting objects: 76, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (49/49), done.
Writing objects: 100% (49/49), 11.00 KiB | 0 bytes/s, done.
Total 49 (delta 37), reused 0 (delta 0)
-----> Fetching custom git buildpack... done
-----> Node.js app detected
PRO TIP: Specify a node version in package.json
See https://devcenter.heroku.com/articles/nodejs-support
-----> Defaulting to latest stable node: 0.10.33
-----> Downloading and installing node
-----> Restoring node_modules directory from cache
-----> Pruning cached dependencies not specified in package.json
-----> Node version changed since last build; rebuilding dependencies
> base64#2.1.0 install /tmp/build_fc23248efe5a35c5b79d9762e3733365/node_modules/base64
> node-gyp rebuild
make: Entering directory `/tmp/build_fc23248efe5a35c5b79d9762e3733365/node_modules/base64/build'
CXX(target) Release/obj.target/base64/base64.o
SOLINK_MODULE(target) Release/obj.target/base64.node
SOLINK_MODULE(target) Release/obj.target/base64.node: Finished
COPY Release/base64.node
ACTION binding_gyp_after_build_target_symlink /tmp/build_fc23248efe5a35c5b79d9762e3733365/node_modules/base64/base64.node
ln: creating symbolic link `/tmp/build_fc23248efe5a35c5b79d9762e3733365/node_modules/base64/base64.node': File exists
make: *** [/tmp/build_fc23248efe5a35c5b79d9762e3733365/node_modules/base64/base64.node] Error 1
make: Leaving directory `/tmp/build_fc23248efe5a35c5b79d9762e3733365/node_modules/base64/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/tmp/build_fc23248efe5a35c5b79d9762e3733365/vendor/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Linux 3.8.11-ec2
gyp ERR! command "node" "/tmp/build_fc23248efe5a35c5b79d9762e3733365/vendor/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/build_fc23248efe5a35c5b79d9762e3733365/node_modules/base64
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! base64#2.1.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the base64#2.1.0 install script.
npm ERR! This is most likely a problem with the base64 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls base64
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.8.11-ec2
npm ERR! command "/tmp/build_fc23248efe5a35c5b79d9762e3733365/vendor/node/bin/node" "/tmp/build_fc23248efe5a35c5b79d9762e3733365/vendor/node/bin/npm" "rebuild"
npm ERR! cwd /tmp/build_fc23248efe5a35c5b79d9762e3733365
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /tmp/build_fc23248efe5a35c5b79d9762e3733365/npm-debug.log
npm ERR! not ok code 0
Old question but I ran into this and solved it via a few routes:
Failed at the base64#2.1.0 install script
Here the base64#2.1.0 might not be compatible with your version of node running your project. Try to install an earlier version.
Delete the ~/.node-gyp folder on your computer (command spacebar and search for ~/.node-gyp) and try reinstalling node-gyp globally.