Node.js install canvas failed on mac osx 10.8.4 : src/Canvas.h.....fatal error: v8.h file not found - macos

I install nodejs following nodejs wiki, it's going well, and then install node canvas following this way https://github.com/LearnBoost/node-canvas/wiki/Installation---OSX, the steps before "$ npm install canvas" were going well, but the final step "$ npm install canvas" was failed again and again, I have tried install the Nodejs both building and installing, and i also try "sudo", and I have try "$ export PKG_CONFIG_PATH=.....", but still can't install canvas, I'm sure I have followed all the guide clarely.
Below is the log:
SLMacs-MacBook-Pro-2:~ percy$ npm install canvas
npm http GET https://registry.npmjs.org/canvas
npm http 304 https://registry.npmjs.org/canvas
> canvas#1.0.3 install /Users/macbookpro/node_modules/canvas
> node-gyp rebuild
CXX(target) Release/obj.target/canvas/src/Canvas.o
In file included from ../src/Canvas.cc:7:
../src/Canvas.h:11:10: fatal error: 'v8.h' file not found
#include <v8.h>
^
1 error generated.
make: *** [Release/obj.target/canvas/src/Canvas.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:96:17)
gyp ERR! stack at Process._handle.onexit (child_process.js:678:10)
gyp ERR! System Darwin 12.4.0
gyp ERR! command "node" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/macbookpro/node_modules/canvas
gyp ERR! node -v v0.8.12
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok
npm ERR! canvas#1.0.3 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the canvas#1.0.3 install script.
npm ERR! This is most likely a problem with the canvas 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 canvas
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 12.4.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "canvas"
npm ERR! cwd /Users/macbookpro
npm ERR! node -v v0.8.12
npm ERR! npm -v 1.1.63
npm ERR! code ELIFECYCLE
npm ERR! Error: EACCES, open 'npm-debug.log'
npm ERR! { [Error: EACCES, open 'npm-debug.log'] errno: 3, code: 'EACCES', path: 'npm-debug.log' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.4.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "canvas"
npm ERR! cwd /Users/macbookpro
npm ERR! node -v v0.8.12
npm ERR! npm -v 1.1.63
npm ERR! path npm-debug.log
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open 'npm-debug.log'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/macbookpro/npm-debug.log
npm ERR! not ok code 0

I just ran into this problem myself. You may need to install some dependencies. Try running the following command in terminal.
brew install pkg-config cairo pango libpng jpeg giflib librsvg
Afterwards, rerun npm install. This worked for me.

To fix it:
Download the source code of node 0.10.13 from http://nodejs.org/dist/v0.10.13/node-v0.10.13.tar.gz
Extract this file via tar -xvz node-v0.10.13.tar.gz
Copy the 'deps', 'src' and 'tools' folders into '~/.node-gyp/0.10.13'
Then run 'npm install canvas' again.
I have no idea why the MacOS node package(just for v0.10.13) is missing these things.

Related

Unable to install sodium to Heroku

I've tried running npm install sodium in the Heroku console but it just returns
npm ERR! code 1
npm ERR! path /app/node_modules/sodium
npm ERR! command failed
npm ERR! command sh -c node install.js --preinstall
npm ERR! Static libsodium was not found at /app/node_modules/sodium/deps/build/lib/libsodium so compiling libsodium from source.
npm ERR! libtool is required, but wasn't found on this system
npm ERR! make: *** [Makefile:62: libsodium] Error 1
npm ERR! /app/node_modules/sodium/install.js:293
npm ERR! throw new Error(cmdLine + ' exited with code ' + code);
npm ERR! ^
npm ERR!
npm ERR! Error: make libsodium exited with code 2
npm ERR! at ChildProcess.<anonymous> (/app/node_modules/sodium/install.js:293:19)
npm ERR! at ChildProcess.emit (node:events:394:28)
npm ERR! at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! A complete log of this run can be found in:
npm ERR! /app/.npm/_logs/2021-08-10T23_25_41_425Z-debug.log
I was led to believe Heroku has libtool installed so I don't see why I can't install sodium.

Install canvas fails using npm

I'm using macOS Mojave, Xcode 10.1. I'm struggling when running npm install canvas. node-gyp is 3.8.0 of mine.
npm WARN package.json babylon#5.5.29 No repository field.
npm WARN package.json babylon#5.5.29 No README data
npm WARN package.json babylon#5.5.29 No license field.
-
> canvas#1.3.12 install /Users/chuoi/project/node_modules/canvas
> node-gyp rebuild
SOLINK_MODULE(target) Release/canvas-postbuild.node
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/canvas-postbuild.node] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/chuoi/.nvm/versions/node/v4.3.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/Users/chuoi/.nvm/versions/node/v4.3.1/bin/node" "/Users/chuoi/.nvm/versions/node/v4.3.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/chuoi/project/node_modules/canvas
gyp ERR! node -v v4.3.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Darwin 18.2.0
npm ERR! argv "/Users/chuoi/.nvm/versions/node/v4.3.1/bin/node" "/Users/chuoi/.nvm/versions/node/v4.3.1/bin/npm" "install" "canvas"
npm ERR! node v4.3.1
npm ERR! npm v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! canvas#1.3.12 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas#1.3.12 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the canvas 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 canvas
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/chuoi/project/middleware/npm-debug.log
Could you help me on this cause it takes a whole day and I have no idea how to fix it.
You need to update your node version. Canvas doesn't support node 4.x.
"The minimum version of Node.js required is 6.0.0."
https://www.npmjs.com/package/canvas

Bower Installation Errors

Now I have installed Node and Npm and I run this command in terminal (yes I am on a mac):
npm install -g bower
Which follows with this output from the terminal:
npm http GET https://registry.npmjs.org/bower
npm http 304 https://registry.npmjs.org/bower
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/bower']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/bower',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/bower',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "bower"
npm ERR! cwd /Users/Superfunnytogo
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! path /usr/local/lib/node_modules/bower
npm ERR! fstream_path /usr/local/lib/node_modules/bower
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/Superfunnytogo/npm-debug.log
npm ERR! not ok code 0
Device-365-352:~ Superfunnytogo$ npm install -g bower
npm http GET https://registry.npmjs.org/bower
npm http 304 https://registry.npmjs.org/bower
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/bower']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/bower',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/bower',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "bower"
npm ERR! cwd /Users/Superfunnytogo
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! path /usr/local/lib/node_modules/bower
npm ERR! fstream_path /usr/local/lib/node_modules/bower
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/Superfunnytogo/npm-debug.log
npm ERR! not ok code 0
You need root access or permissions to install globally! Try :
sudo npm install -g bower
Much better than using sudo is setting a user level prefix. For example in ~/.npmrc set:
prefix = ${HOME}/npm-global
to use this folder for packages installed with -g.
Then you also need to set your PATH environment variable to include ${HOME}/npm-global/bin.
you shouldn't sudo bower right? I mean sudo npm install -g bower will work BUT here's the message I got:
Additional error details:
Since bower is a user command, there is no need to execute it with superuser permissions.
If you're having permission errors when using bower without sudo, please spend a few minutes learning more about how your system should work and make any necessary repairs.
http://www.joyent.com/blog/installing-node-and-npm
https://gist.github.com/isaacs/579814
You can however run a command with sudo using --allow-root option
If you've installed node/npm via Homebrew on OSX you may want to first run brew doctor and follow instructions before sudo-ing any system folders. In my case this brought up a nag about agreeing to an Xcode/iOS license:
Builds will fail! Agree to the license by opening Xcode.app or running:
xcodebuild -license
After doing that and running a brew update I was able to install Bower globally as expected.
I know that it's an old thread but I run into the issue recently after reinstalling Yosemite and xCode tools. In case anyone else gets stuck, what helped me was using the commands:
sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
Following suggestion from the thread below:
https://github.com/bower/bower/issues/2262
Using sudo with npm is discouraged.
Look here https://stackoverflow.com/a/18277225/1857521 for a better solution to an almost identical problem.

npm install xml2json fail to install

I am trying to work on PUSh notifications for Android/ios using node.js.
I am getting the below error when I try to install xml2json.
Please help me to fix it
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:43:28)
gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:46:29)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:57:16
gyp ERR! stack at Object.oncomplete (fs.js:107:15)
gyp ERR! System Darwin 12.5.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/bertils/node_modules/xml2json/node_modules/node-expat
gyp ERR! node -v v0.10.24
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok
npm ERR! node-expat#2.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat#2.0.0 install script.
npm ERR! This is most likely a problem with the node-expat 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 node-expat
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 12.5.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "xml2json"
npm ERR! cwd /Users/bertils
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/bertils/npm-debug.log
npm ERR! not ok code 0
Looks like the make tool is not available on your system.
To fix this, you have 2 options:
If you have Xcode already installed:
Go to Xcode > Preferences > Downloads and install the component named "Command Line Tools". All the relevant tools will be placed in /usr/bin.
Alternative:
Go to https://developer.apple.com/downloads, sign in with your developer Apple ID and search for "Command Line Tools", then download and install the appropriate file.
I was also facing the same issue on linux rhel 7, see if it works for you too, what I found out was that I needed to install gcc libraries on my instance, so I went ahead and removed my node_modules folder and then ran the sudo yum group install "Development Tools", in your case you might want to find the brew equivalent sudo yum group install "Development Tools" or xcode-select --install, and I then ran the npm install again and it worked!
Hope this helps, for issues related to installing gcc libraries and Development tools, one can refer to this url also: Install gcc and dev tools or Mac OS install dev tools

Fail to install cordova with npm on Mac os x

Hi i'm trying to install cordova with npm with
sudo npm install -g cordova
And i have this error
npm ERR! Error: EACCES, symlink '../lib/node_modules/cordova/bin/cordova'
npm ERR! { [Error: EACCES, symlink '../lib/node_modules/cordova/bin/cordova']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '../lib/node_modules/cordova/bin/cordova' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "cordova"
npm ERR! cwd /Users/yannickghilardi
npm ERR! node -v v0.10.21
npm ERR! npm -v 1.3.11
npm ERR! path ../lib/node_modules/cordova/bin/cordova
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, symlink '../lib/node_modules/cordova/bin/cordova'
npm ERR! Error: EACCES, open 'npm-debug.log'
npm ERR! { [Error: EACCES, open 'npm-debug.log'] errno: 3, code: 'EACCES', path: 'npm-debug.log' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "cordova"
npm ERR! cwd /Users/yannickghilardi
npm ERR! node -v v0.10.21
npm ERR! npm -v 1.3.11
npm ERR! path npm-debug.log
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open 'npm-debug.log'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/yannickghilardi/npm-debug.log
npm ERR! not ok code 0
Then i tried to use this command
sudo chown -R yannickghilardi /usr/local/lib/node_modules
And i have this error message
Operation not permitted
Is there a solution to this problem?
Thanks in advance
Just now i solved this issue. Execute this command by going into to the root folder.
Destination folder -- > /usr/local/lib/node_modules/ and type the command sudo npm install -g cordova
I tried installing using the command npm i -g cordova-res --unsafe-perm. It worked fine.

Resources