I'm trying to run the command 'npm install leaflet-headless' so I can use the leaflet map API with Node.js easily. Upon entering this command I receive the following error:
我正在尝试运行命令'npm install leaflet-headless',因此我可以轻松地使用带有Node.js的传单映射API。输入此命令后,我收到以下错误:
C:\Users\Rocco\Desktop\Node3\kdApp>npm install leaflet-headless
> canvas@1.3.16 install C:\Users\Rocco\Desktop\Node3\kdApp\node_modules\leaflet-headless\node_modules\canvas
> node-gyp rebuild
-
C:\Users\Rocco\Desktop\Node3\kdApp\node_modules\leaflet-headless\node_modules\canvas>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:449:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:404:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15)
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:\Users\Rocco\Desktop\Node3\kdApp\node_modules\leaflet-headless\node_modules\canvas
gyp ERR! node -v v4.6.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
> contextify@0.1.15 install C:\Users\Rocco\Desktop\Node3\kdApp\node_modules\leaflet-headless\node_modules\jsdom\node_modules\contextify
> node-gyp rebuild
C:\Users\Rocco\Desktop\Node3\kdApp\node_modules\leaflet-headless\node_modules\jsdom\node_modules\contextify>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:449:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:404:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15)
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:\Users\Rocco\Desktop\Node3\kdApp\node_modules\leaflet-headless\node_modules\jsdom\node_modules\contextify
gyp ERR! node -v v4.6.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
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! canvas@1.3.16 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas@1.3.16 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:\Users\Rocco\Desktop\Node3\kdApp\npm-debug.log
Any help or guidance would be greatly appreciated. Thank you!
任何帮助或指导将不胜感激。谢谢!
1 个解决方案
#1
1
The line gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
mean that either Python is not installed or the variable to tell node.js where to search for the executeable (python.exe) is not set. So do the following:
线路gyp ERR! stack错误:找不到Python可执行文件“python”,可以设置PYTHON env变量。意味着没有安装Python或者告诉node.js的变量在哪里搜索可执行文件(python.exe)没有设置。所以做以下事情:
1) Install Python
1)安装Python
2) Set the evironment variable in the cmd set PYTHON=C:\{Path to your python install folder}\Python.exe
(Default on windows C:\Python27\python.exe
)
2)在cmd集中设置环境变量PYTHON = C:\ {python安装文件夹的路径} \ Python.exe(Windows C上的默认值:\ Python27 \ python.exe)
#1
1
The line gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
mean that either Python is not installed or the variable to tell node.js where to search for the executeable (python.exe) is not set. So do the following:
线路gyp ERR! stack错误:找不到Python可执行文件“python”,可以设置PYTHON env变量。意味着没有安装Python或者告诉node.js的变量在哪里搜索可执行文件(python.exe)没有设置。所以做以下事情:
1) Install Python
1)安装Python
2) Set the evironment variable in the cmd set PYTHON=C:\{Path to your python install folder}\Python.exe
(Default on windows C:\Python27\python.exe
)
2)在cmd集中设置环境变量PYTHON = C:\ {python安装文件夹的路径} \ Python.exe(Windows C上的默认值:\ Python27 \ python.exe)