I'm trying to push a Node app to heroku, but I am using imagemagick-native and it seems that Heroku is having an issue with Magick++ - I've tried using custom build packs but can't seem to find one that supports Magick++. (1) Is this the issue (2) Is there any solution to run Magick++ on Heorku?
-----> Node.js app detected
-----> Resolving engine versions
Using Node.js version: 0.10.20
Using npm version: 1.3.11
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
npm WARN package.json upload#0.1.3 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
> bson#0.2.2 install /tmp/build_d2a98573-34b8-42d9-91ff-81c4ca84feb9/node_modules/mongoose/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory `/tmp/build_d2a98573-34b8-42d9-91ff-81c4ca84feb9/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'
CXX(target) Release/obj.target/bson/ext/bson.o
SOLINK_MODULE(target) Release/obj.target/bson.node
SOLINK_MODULE(target) Release/obj.target/bson.node: Finished
COPY Release/bson.node
make: Leaving directory `/tmp/build_d2a98573-34b8-42d9-91ff-81c4ca84feb9/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'
> kerberos#0.0.3 install /tmp/build_d2a98573-34b8-42d9-91ff-81c4ca84feb9/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory `/tmp/build_d2a98573-34b8-42d9-91ff-81c4ca84feb9/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos/build'
SOLINK_MODULE(target) Release/obj.target/kerberos.node
SOLINK_MODULE(target) Release/obj.target/kerberos.node: Finished
COPY Release/kerberos.node
make: Leaving directory `/tmp/build_d2a98573-34b8-42d9-91ff-81c4ca84feb9/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos/build'
> imagemagick-native#0.2.8 install /tmp/build_d2a98573-34b8-42d9-91ff-81c4ca84feb9/node_modules/imagemagick-native
> node-gyp rebuild
/bin/sh: Magick++-config: not found
gyp: Call to 'Magick++-config --ldflags --libs' returned exit status 127. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/tmp/node-npm-k25M/node_modules/node-gyp/lib/configure.js:424:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.8.11-ec2
gyp ERR! command "node" "/tmp/node-npm-k25M/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/build_d2a98573-34b8-42d9-91ff-81c4ca84feb9/node_modules/imagemagick-native
gyp ERR! node -v v0.10.20
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0
! Failed to rebuild dependencies with npm
! Push rejected, failed to compile Node.js app
I've made some progress on this:
Use the multi buildpack:
heroku config:set BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
So that it can load the apt-buildpack in addition to the nodejs one. List your builpacks in .buildpacks:
https://github.com/ddollar/heroku-buildpack-apt.git
https://github.com/heroku/heroku-buildpack-nodejs.git
Now install libmagick++-dev through apt by listing it in a file called Aptfile.
Now if you include imagemagick-native in your package.json:
"dependencies": {
"imagemagick-native": "1.7.0"
}
It will start compiling. And although $CPATH is set properly by the APT package, node-gyp somehow doesn't seem to forward it to gcc.
This causes the following error:
remote: > imagemagick-native#1.7.0 install /tmp/build_720834c3a32b65d69ae603d7c618e20f/node_modules/imagemagick-native
remote: > node-gyp rebuild
remote:
remote: make: Entering directory `/tmp/build_720834c3a32b65d69ae603d7c618e20f/node_modules/imagemagick-native/build'
remote: CXX(target) Release/obj.target/imagemagick/src/imagemagick.o
remote: In file included from ../src/imagemagick.cc:9:
remote: ../src/imagemagick.h:1:22: warning: Magick++.h: No such file or directory
So it doesn't solve the problem yet, but I think it's on the right track. Still trying to figure out what's up with node-gyp.
Update
To workaround that problem fork the nodejs buildpack and add the following lines to the top of bin/compile:
path=`echo "$INCLUDE_PATH" | cut -d : -f 1`
export CXX="`which g++` -I$path/ImageMagick"
Works on cedar-14. For the deprecated cedar you would need to use imagemagick-native v1.22.
Related
-----> Building on the Heroku-20 stack
-----> 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): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 14.x...
Downloading and installing node 14.16.0...
Using default npm version: 6.14.11
-----> 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
Prebuild detected (node_modules already exists)
Rebuilding any native modules
> canvas#2.6.1 install /tmp/build_dc388f20_/node_modules/canvas
> node-pre-gyp install --fallback-to-build
sh: 1: node-pre-gyp: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! canvas#2.6.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the canvas#2.6.1 install 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.40jbb/_logs/2021-03-05T17_30_09_270Z-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_modules checked into source control
https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits
- 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
How do i fix this?
When i try to run the bot in Heroku, it keeps giving me the same error and not turning the bot on. How would i go on to fix this issue? All the files and node modules are already installed in the github repository
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 12.x...
Downloading and installing node 12.19.1...
Using default npm version: 6.14.8
-----> Installing dependencies
Prebuild detected (node_modules already exists)
Rebuilding any native modules
> #discordjs/opus#0.3.2 install /tmp/build_8234188f_/node_modules/#discordjs/opus
> node-pre-gyp install --fallback-to-build
sh: 1: node-pre-gyp: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! #discordjs/opus#0.3.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the #discordjs/opus#0.3.2 install 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.tAPfy/_logs/2020-11-22T22_42_39_963Z-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_modules checked into source control
https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
I tried to deploy the default jhipster registry by using the button deploy to heroku but it failed.
Can anyone help me please ?
parameters:
App name
myapp-registry
Choose a region United states
JHIPSTER_PASSWORD ******
JAVA_OPTS
-Xmx256m -Xss512k -Dfile.encoding=UTF-8
MAVEN_CUSTOM_OPTS
-Pprod,heroku -DskipTests
NPM_CONFIG_PRODUCTION
false
logs:
binding.target.mk:115: recipe for target 'Release/obj.target/binding/src/binding.o' failed
make: *** [Release/obj.target/binding/src/binding.o] Error 1
make: Leaving directory '/tmp/build_e5224961c3b8d6585d4f090ac485ceae/node_modules/node-sass/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/tmp/build_e5224961c3b8d6585d4f090ac485ceae/node_modules/node-gyp/lib/build.js:285:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:225:12)
gyp ERR! System Linux 4.4.0-1014-aws
gyp ERR! command
"/tmp/build_e5224961c3b8d6585d4f090ac485ceae/.heroku/node/bin/node"
"/tmp/build_e5224961c3b8d6585d4f090ac485ceae/node_modules/node-gyp/bin/node-gyp.js"
"rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags="
"--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd >
/tmp/build_e5224961c3b8d6585d4f090ac485ceae/node_modules/node-sass
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.0
gyp ERR! not ok
Build failed with error code: 1
-----> 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:
- Dangerous semver range (>) in engines.node
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app. ! Push failed
This issue resulted from an incompatibility with Node 10. It was fixed in the JHipster Registry code by this pull request. The Deploy to Heroku button now works correctly
This issue is caused by node-saas which didn't manage to download a valid binary for your environment so it is trying to rebuild the C++ code from scratch which seems like it's not available in the Heroku runner.
Please upgrade to node-saas v4.9.0 which is the first version that supports Node 10: https://github.com/sass/node-sass/releases/tag/v4.9.0
I am deploying a site built upon MEAN stack on Heroku. While troubleshooting an issue I removed node_modules/ from my .gitignore file and ever since my app has been getting "Build failed" errors.
I readded node_modules/ to the file, but it seems the damage has been done as builds still fail.
One of the possible problems that is suggested in the log is:
"- node_modules checked into source control"
How do I go about undoing what I did?
-----> Deleting 1 files matching .slugignore patterns.
-----> Using set buildpack heroku/nodejs
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 0.10.x
engines.npm (package.json): 2.x.x
Resolving node version 0.10.x via semver.io...
Downloading and installing node 0.10.41...
Resolving npm version 2.x.x via semver.io...
Downloading and installing npm 2.14.15 (replacing version 1.4.29)...
npm WARN deprecated This version of npm lacks support for important features,
npm WARN deprecated such as scoped packages, offered by the primary npm
npm WARN deprecated registry. Consider upgrading to at least npm#2, if not the
npm WARN deprecated latest stable version. To upgrade to npm#2, run:
npm WARN deprecated
npm WARN deprecated npm -g install npm#latest-2
npm WARN deprecated
npm WARN deprecated To upgrade to the latest stable version, run:
npm WARN deprecated
npm WARN deprecated npm -g install npm#latest
npm WARN deprecated
npm WARN deprecated (Depending on how Node.js was installed on your system, you
npm WARN deprecated may need to prefix the preceding commands with `sudo`, or if
npm WARN deprecated on Windows, run them from an Administrator prompt.)
npm WARN deprecated
npm WARN deprecated If you're running the version of npm bundled with
npm WARN deprecated Node.js 0.10 LTS, be aware that the next version of 0.10 LTS
npm WARN deprecated will be bundled with a version of npm#2, which has some small
npm WARN deprecated backwards-incompatible changes made to `npm run-script` and
npm WARN deprecated semver behavior.
-----> Restoring cache
Loading 2 from cacheDirectories (default):
- node_modules (exists - skipping)
- bower_components (not cached - skipping)
-----> Building dependencies
Prebuild detected (node_modules already exists)
Rebuilding any native modules
> bson#0.2.22 install /tmp/build_###########/node_modules/connect-mongo/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory `/tmp/build_###########/node_modules/connect-mongo/node_modules/bson/build'
CXX(target) Release/obj.target/bson/ext/bson.o
SOLINK_MODULE(target) Release/obj.target/bson.node
COPY Release/bson.node
make: Leaving directory `/tmp/build_###########/node_modules/connect-mongo/node_modules/bson/build'
> bson#0.2.22 install /tmp/build_###########/node_modules/connect-mongo/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory `/tmp/build_###########/node_modules/connect-mongo/node_modules/bson/build'
CXX(target) Release/obj.target/bson/ext/bson.o
SOLINK_MODULE(target) Release/obj.target/bson.node
COPY Release/bson.node
make: Leaving directory `/tmp/build_###########/node_modules/connect-mongo/node_modules/bson/build'
> bson#0.2.22 install /tmp/build_###########/node_modules/mongoose/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory `/tmp/build_###########/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'
CXX(target) Release/obj.target/bson/ext/bson.o
SOLINK_MODULE(target) Release/obj.target/bson.node
COPY Release/bson.node
make: Leaving directory `/tmp/build_###########/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'
> phantomjs#1.9.19 install /tmp/build_###########/node_modules/phantomjs
> node install.js
PhantomJS not found on PATH
Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2
Receiving...
Received 12854K total.
Extracting tar contents (via spawned process)
Removing /tmp/build_###########/node_modules/phantomjs/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1450118671217/phantomjs-1.9.8-linux-x86_64 -> /tmp/build_###########/node_modules/phantomjs/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /tmp/build_###########/node_modules/phantomjs/lib/phantom/bin/phantomjs
> kerberos#0.0.11 install /tmp/build_###########/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory `/tmp/build_###########/node_modules/kerberos/build'
CXX(target) Release/obj.target/kerberos/lib/kerberos.o
CXX(target) Release/obj.target/kerberos/lib/worker.o
CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
CC(target) Release/obj.target/kerberos/lib/base64.o
CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
SOLINK_MODULE(target) Release/obj.target/kerberos.node
COPY Release/kerberos.node
make: Leaving directory `/tmp/build_###########/node_modules/kerberos/build'
> ws#0.4.32 install /tmp/build_###########/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory `/tmp/build_###########/node_modules/ws/build'
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
SOLINK_MODULE(target) Release/obj.target/bufferutil.node
COPY Release/bufferutil.node
CXX(target) Release/obj.target/validation/src/validation.o
SOLINK_MODULE(target) Release/obj.target/validation.node
COPY Release/validation.node
make: Leaving directory `/tmp/build_###########/node_modules/ws/build'
> v8-profiler#5.2.12 preinstall /tmp/build_###########/node_modules/v8-profiler
>
> v8-profiler#5.2.12 install /tmp/build_###########/node_modules/v8-profiler
> node-pre-gyp install --fallback-to-build
sh: 1: node-pre-gyp: Permission denied
npm ERR! Linux 3.13.0-71-generic
npm ERR! argv "node" "/tmp/build_###########/.heroku/node/bin/npm" "rebuild"
npm ERR! node v0.10.41
npm ERR! npm v2.14.15
npm ERR! code ELIFECYCLE
npm ERR! v8-profiler#5.2.12 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the v8-profiler#5.2.12 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the v8-profiler package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR! npm owner ls v8-profiler
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /tmp/build_###########/npm-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_modules checked into source control
https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
Love,
Heroku
! Push rejected, failed to compile Node.js app
Although you've re-added node_modules to your .gitignore, as you say, the damage has already been done. So you need to remove node_modules from your git repo. Try this:
git rm -r --cached node_modules
git commit -m 'Remove node_modules'
The first command recursively removes node_modules from the git repo without removing your local files, the second commits the removal.
You can then push your changes to Heroku.
Problem Can't install socket.io in laravel vagrant homestead. Bellow error was thrown.
Command npm install socket.io
Error
> ws#0.5.0 install /home/vagrant/Code/dota2/nodejs/node_modules/socket.io/node_m
odules/engine.io/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory `/home/vagrant/Code/dota2/nodejs/node_modules/socket.io
/node_modules/engine.io/node_modules/ws/build'
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
SOLINK_MODULE(target) Release/obj.target/bufferutil.node
SOLINK_MODULE(target) Release/obj.target/bufferutil.node: Finished
COPY Release/bufferutil.node
CXX(target) Release/obj.target/validation/src/validation.o
SOLINK_MODULE(target) Release/obj.target/validation.node
SOLINK_MODULE(target) Release/obj.target/validation.node: Finished
COPY Release/validation.node
make: Leaving directory `/home/vagrant/Code/dota2/nodejs/node_modules/socket.io/
node_modules/engine.io/node_modules/ws/build'
npm ERR! Error: UNKNOWN, symlink '../ws/bin/wscat'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Linux 3.13.0-30-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /home/vagrant/Code/dota2/nodejs
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path ../ws/bin/wscat
npm ERR! code UNKNOWN
npm ERR! errno -1
npm ERR! not ok code 0
Vagrant/Homestead virtual machine can't handle binary links.
Instead of
npm install socket.io
use
npm install socket.io --no-bin-links