2017-03-16 45 views
0

我是nodejs中的新手。 當我要安裝blueimp-file-upload-expressjs時,會出現以下錯誤。無法在expressjs中安裝jQuery文件上傳

D:\WorkShop\Express\zipzap>npm install blueimp-file-upload-expressjs --save 
npm WARN deprecated [email protected]: This package is discontinued. Use [email protected]^4.0.0. 

> [email protected] install D:\WorkShop\Express\zipzap\node_modules\lwip 
> node-gyp rebuild 


D:\WorkShop\Express\zipzap\node_modules\lwip>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 PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:454:19) 
gyp ERR! stack  at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:480:16) 
gyp ERR! stack  at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29 
gyp ERR! stack  at FSReqWrap.oncomplete (fs.js:114: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 D:\WorkShop\Express\zipzap\node_modules\lwip 
gyp ERR! node -v v7.7.2 
gyp ERR! node-gyp -v v3.5.0 
gyp ERR! not ok 
[email protected] D:\WorkShop\Express\zipzap 
+-- [email protected] extraneous 
+-- [email protected] extraneous 
+-- [email protected] extraneous 
`-- [email protected] extraneous 

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" "blueimp-file-upload-expressjs" "--save" 
npm ERR! node v7.7.2 
npm ERR! npm v4.1.2 
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! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, this is most likely a problem with the lwip 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 lwip 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls lwip 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  D:\WorkShop\Express\zipzap\npm-debug.log 

D:\WorkShop\Express\zipzap> 

如何安裝並使用此插件?也不明白什麼是實際的錯誤。 我正在研究nodejs。那麼它爲什麼要求python路徑?

+0

我可以提出兩種選擇:首先將節點降級到6並再次測試,其次:可能升級node-gyp @ latest並再次檢查,請參閱https://github.com/EyalAr/lwip/issues/206 – Majid

回答

0

@Dipankar Naskar:那爲什麼要求python路徑?

因爲Node.js是用GYP構建的 - 用Python編寫的跨平臺構建工具。還有一些其他的構建步驟是在Python中實現的。所以Python是從源代碼構建節點所必需的。

@Dipankar Naskar:如何安裝並使用此插件?

這是幾乎情況下的解決方案。

的配置步驟,Node.js的現在應該如下:

安裝VC++ Build Tools Technical Preview,選擇自定義安裝,並選擇在Windows 8.1和Windows 10軟件開發工具包。

[僅限於Windows 7]需要.NET Framework 4.5.1

安裝Python 2.7或3.6,並將其添加到您的PATHnpm config set python python2.7

啓動CMD,npm config set msvs_version 2015 --global(這是不是每次都npm install [package name] --msvs_version=2015。 )

SO SOCHnpm install

注意:有了您的問題,您只需安裝Python,將其添加到您的PATH,npm config set python python2.7