Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
221 views
in Technique[技术] by (71.8m points)

node.js - "npm install leaflet-headless" returning errors after Python installation

I'm trying to run the command 'npm install leaflet-headless' so I can use the leaflet map API with Node.js easily. I just installed Python and set the directory (as this was the previous error in this particular installation), but now I am getting a new error which I can't quite decipher:

Note - I'm guessing this requires GTK, though I just have no idea how to set it for use with this specific command. All the installs seem to not be in the directory required by this command.

> [email protected] install C:UsersRoccoDesktopNode3kdApp
ode_modulesleaflet-headless
ode_modulescanvas
> node-gyp rebuild


C:UsersRoccoDesktopNode3kdApp
ode_modulesleaflet-headless
ode_modulescanvas>if not defined npm_config_node_gyp (node "C:Program Files
odejs
ode_modules
pmin
ode-gyp-bin\....
ode_modules
ode-gypin
ode-gyp.js" rebuild )  else (node "" rebuild )
Warning: Missing input files:
C:GTKinzlib1.dll
C:GTKinlibexpat-1.dll
C:GTKinlibpng14-14.dll
C:GTKinlibcairo-2.dll
C:GTKinlibfontconfig-1.dll
C:GTKinlibfreetype-6.dll
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  Canvas.cc
  CanvasGradient.cc
  CanvasPattern.cc
  CanvasRenderingContext2d.cc
c:users
occodesktop
ode3kdapp
ode_modulesleaflet-headless
ode_modulescanvassrcCanvas.h(19): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory (compiling source file ..srcCanvasGradient.cc) [C:UsersRoccoDesktopNode3kdApp
ode_modulesleaflet-headless
ode_modulescan
vasuildcanvas.vcxproj]
c:users
occodesktop
ode3kdapp
ode_modulesleaflet-headless
ode_modulescanvassrcCanvas.h(19): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory (compiling source file ..srcCanvas.cc) [C:UsersRoccoDesktopNode3kdApp
ode_modulesleaflet-headless
ode_modulescanvasuil
dcanvas.vcxproj]
c:users
occodesktop
ode3kdapp
ode_modulesleaflet-headless
ode_modulescanvassrcCanvas.h(19): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory (compiling source file ..srcCanvasPattern.cc) [C:UsersRoccoDesktopNode3kdApp
ode_modulesleaflet-headless
ode_modulescanv
asuildcanvas.vcxproj]
  color.cc
  Image.cc
  ImageData.cc
c:users
occodesktop
ode3kdapp
ode_modulesleaflet-headless
ode_modulescanvassrcCanvas.h(19): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory (compiling source file ..srcImage.cc) [C:UsersRoccoDesktopNode3kdApp
ode_modulesleaflet-headless
ode_modulescanvasuild
canvas.vcxproj]
c:users
occodesktop
ode3kdapp
ode_modulesleaflet-headless
ode_modulescanvassrcCanvas.h(19): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory (compiling source file ..srcImageData.cc) [C:UsersRoccoDesktopNode3kdApp
ode_modulesleaflet-headless
ode_modulescanvas
uildcanvas.vcxproj]
  init.cc
  win_delay_load_hook.cc
c:users
occodesktop
ode3kdapp
ode_modulesleaflet-headless
ode_modulescanvassrcCanvas.h(19): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory (compiling source file ..srcinit.cc) [C:UsersRoccoDesktopNode3kdApp
ode_modulesleaflet-headless
ode_modulescanvasuild
canvas.vcxproj]
c:users
occodesktop
ode3kdapp
ode_modulesleaflet-headless
ode_modulescanvassrcCanvas.h(19): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory (compiling source file ..srcCanvasRenderingContext2d.cc) [C:UsersRoccoDesktopNode3kdApp
ode_modulesleaflet-headless
ode_m
odulescanvasuildcanvas.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:Program Files (x86)MSBuild14.0inmsbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:Program Files
odejs
ode_modules
pm
ode_modules
ode-gyplibuild.js:276: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 Windows_NT 10.0.14393
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:UsersRoccoDesktopNode3kdApp
ode_modulesleaflet-headless
ode_modulescanvas
gyp ERR! node -v v4.6.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

> [email protected] install C:UsersRoccoDesktopNode3kdApp
ode_modulesleaflet-headless
ode_modulesjsdom
ode_modulescontextify
> node-gyp rebuild


C:UsersRoccoDesktopNode3kdApp
ode_modulesleaflet-headless
ode_modulesjsdom
ode_modulescontextify>if not defined npm_config_node_gyp (node "C:Program Files
odejs
ode_modules
pmin
ode-gyp-bin\....
ode_modules
ode-gypin
ode-gyp.js" rebuild )  else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  contextify.cc
  win_delay_load_hook.cc
     Creating library C:UsersRoccoDesktopNode3kdApp
ode_modulesleaflet-headless
ode_modulesjsdom
ode_modulescontextifyuildReleasecontextify.lib and object C:UsersRoccoDesktopNode3kdApp
ode_modulesleaflet-headless
ode_modulesjsdom
ode_modulescontextifyuildReleasecontextify.exp
  Generating code
  Finished generating code
  contextify.vcxproj -> C:UsersRoccoDesktopNode3kdApp
ode_modulesleaflet-headless
ode_modulesjsdom
ode_modulescontextifyuildRelease\contextify.node
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "leaflet-headless"
npm ERR! node v4.6.0
npm ERR! npm  v2.15.9
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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 information on how to open an issue for this project with:
npm ERR!     npm bugs canvas
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
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!     C:UsersRoccoDesktopNode3kdApp
pm-debug.log
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

node-gyp needs python and Visual Studio installed and the path to their executables. This walkaround fixed it for me:

Uninstall the following products and then reinstall them in the order listed:

1) Visual C++ 2010 Express

2) Windows SDK 7.1

3) Visual Studio 2010 SP1

4) Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1

Be sure that you env paths are set correctly !


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...