Automattic / node-canvas

Node canvas is a Cairo backed Canvas implementation for NodeJS.
10.11k stars 1.16k forks source link

Installation Windows (64 bit) #619

Closed zorobabel closed 9 years ago

zorobabel commented 9 years ago

I was trying to install node-canvas but without success.

zorobabel commented 9 years ago

After a few hours of research, this is my two cents:


All installed dependencies are 64 bit.

Environment

Steps

  1. Follow the guide "Installation Windows" until step #3.
  2. Open a terminal and execute the following commands:

npm config set msvs_version 2015 --global

npm install canvas

Congratulations! You've successfully installed node-canvas.

Note: Please, it's IMPORTANT to follow the guidelines exactly as you see.

Troubleshooting

I had some problems installing another modules. For example, node-gyp is another problematic module when you want to install it on Windows (check this) but this guide is excellent to getting things installed:

Building using Node-GYP with Visual Studio Express 2015 on Windows 10 Pro x64

The guide works fine for Windows 8.1, because Windows 10 is Windows 8.1 with plastic surgery =D. In my case I just had to set the environment variable (GYP_MSVS_VERSION=2015). By the way, if you want to a painless environment variables management, you can use Rapid Environment Editor.

Testing

To test if everything is ok, I've used Trianglify:

npm install trianglify cd node_modules/trianglify/examples node save-as-png.js random.png

If you can see random.png inside of examples/, you can breathe =)

Final words

HTH!

klentgary commented 8 years ago

Hello sir, I got an error when Im trying to install the canvas. please help me,

this is the error I've got.

C:\Users\admin>npm -g install
npm ERR! addLocal Could not install C:\Users\admin
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files (x86)\\Mobile App\\node.exe" "C:\\Program Files (x86)\\Mobile App\\node_modules\\npm\\bin\\npm-cli.js" "-g" "install"
npm ERR! node v4.1.0
npm ERR! npm  v2.14.3
npm ERR! code EISDIR
npm ERR! errno -4068
npm ERR! syscall read

npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\admin\npm-debug.log
LinusU commented 8 years ago

@klentgary Did you follow the instructions posted? It seems like you only ran npm -g install, that wouldn't install canvas at all.

What you want to do is either npm install canvas or follow the instructions posted above.

zorobabel commented 8 years ago

@klentgary, as @LinusU says, did you follow all instructions? did you install all the dependencies?

I've updated the step 4.

zorobabel commented 8 years ago

Instructions updated

LinusU commented 8 years ago

@zorobabel Thanks a ton for the instructions, and for linking the bugs! I've gone thru and closed them :+1:

zorobabel commented 8 years ago

@LinusU You're welcome, thanks to you, too!

joxford-soltech commented 8 years ago

If anyone is still seeing errors related to a win_delay_load_hook.c file, take a look at this issue.

Basically you need to node-gyp global path, it should be something like

C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src

and open the win_delay_load_hook.c file with a text editor in Administrator Mode. Add

ifndef DELAYIMP_INSECURE_WRITABLE_HOOKS

define DELAYIMP_INSECURE_WRITABLE_HOOKS

endif

before the first #include

imyevolove commented 7 years ago

ohh god. THANK YOU SO MUCH!!!! I LOVE YOU!!

ghost commented 6 years ago

Is this going to be merged? Into code? In to instructions?

zbjornson commented 6 years ago

joxford-soltech's comment was fixed in node-gyp, it's not a canvas issue.

ghost commented 6 years ago

How is running npm install canvas and getting that error not a canvas issue?

On Fri, Oct 27, 2017 at 11:28 AM, Zach Bjornson notifications@github.com wrote:

joxford-soltech's comment was fixed in node-gyp, it's not a canvas issue.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Automattic/node-canvas/issues/619#issuecomment-340049390, or mute the thread https://github.com/notifications/unsubscribe-auth/AX5XbnxqyV5GM76tZoc9apgqn3zrTquJks5swiDQgaJpZM4F0uXR .

-- CONFIDENTIALITY NOTICE: The contents of this email message and any attachments are intended solely for the addressee(s) and may contain confidential and/or privileged information and may be legally protected from disclosure. It is then shared with tech companies, bots, hackers, government agencies, and marketers. The security of this message is none, and it may be shared on Instagram at anytime. If you are OK with this, please respond. There isn't really any security or privacy anywhere. If you disagree you may want to go camping and talk to people face-to-face like in old times.

ghost commented 6 years ago

Everything that canvas depends on, when you add a dependency, you inherit all of that dependencies' issues also. When node-gyp changes and it breaks building canvas that is both a node-gyp issue and a canvas issue because it's a dependency.

On Fri, Oct 27, 2017 at 11:41 AM, Brian Cullinan megamindbrian@gmail.com wrote:

How is running npm install canvas and getting that error not a canvas issue?

On Fri, Oct 27, 2017 at 11:28 AM, Zach Bjornson notifications@github.com wrote:

joxford-soltech's comment was fixed in node-gyp, it's not a canvas issue.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Automattic/node-canvas/issues/619#issuecomment-340049390, or mute the thread https://github.com/notifications/unsubscribe-auth/AX5XbnxqyV5GM76tZoc9apgqn3zrTquJks5swiDQgaJpZM4F0uXR .

-- CONFIDENTIALITY NOTICE: The contents of this email message and any attachments are intended solely for the addressee(s) and may contain confidential and/or privileged information and may be legally protected from disclosure. It is then shared with tech companies, bots, hackers, government agencies, and marketers. The security of this message is none, and it may be shared on Instagram at anytime. If you are OK with this, please respond. There isn't really any security or privacy anywhere. If you disagree you may want to go camping and talk to people face-to-face like in old times.

-- CONFIDENTIALITY NOTICE: The contents of this email message and any attachments are intended solely for the addressee(s) and may contain confidential and/or privileged information and may be legally protected from disclosure. It is then shared with tech companies, bots, hackers, government agencies, and marketers. The security of this message is none, and it may be shared on Instagram at anytime. If you are OK with this, please respond. There isn't really any security or privacy anywhere. If you disagree you may want to go camping and talk to people face-to-face like in old times.