簡體   English   中英

gyp ERR:堆棧錯誤:找不到 Python 可執行文件“C.\Users\Admin\Anaconda3\python,EXE”,您可以設置 PYTHON 環境變量

[英]gyp ERR! stack Error: Can't find Python executable “C:\Users\Admin\Anaconda3\python.EXE”, you can set the PYTHON env variable

我已經從 github 下載了一個項目並嘗試在我的應用程序中npm install但我得到了這個錯誤結果:

> node-sass@4.9.0 install C:\Users\Admin\Desktop\New folder\flow\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.0/win32-x64-72_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.9.0/win32-x64-72_binding.node":

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

> node-sass@4.9.0 postinstall C:\Users\Admin\Desktop\New folder\flow\node_modules\node-sass
> node scripts/build.js

Building: C:\Program Files\nodejs\node.exe C:\Users\Admin\Desktop\New folder\flow\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\Users\\Admin\\Desktop\\New folder\\flow\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.7.0
gyp info using node@12.13.0 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\Admin\Desktop\New folder\flow\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\Admin\Desktop\New folder\flow\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\Admin\Desktop\New folder\flow\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\Admin\Desktop\New folder\flow\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\Admin\Desktop\New folder\flow\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\Admin\Desktop\New folder\flow\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:158:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\Admin\Desktop\New folder\flow\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\Admin\Desktop\New folder\flow\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\Admin\Desktop\New folder\flow\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\Admin\Desktop\New folder\flow\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\Admin\Desktop\New folder\flow\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\Admin\Desktop\New folder\flow\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:158:21) {
gyp verb `which` failed   stack: 'Error: not found: python2\n' +
gyp verb `which` failed     '    at getNotFoundError (C:\\Users\\Admin\\Desktop\\New folder\\flow\\node_modules\\which\\which.js:13:12)\n' +
gyp verb `which` failed     '    at F (C:\\Users\\Admin\\Desktop\\New folder\\flow\\node_modules\\which\\which.js:68:19)\n' +
gyp verb `which` failed     '    at E (C:\\Users\\Admin\\Desktop\\New folder\\flow\\node_modules\\which\\which.js:80:29)\n' +
gyp verb `which` failed     '    at C:\\Users\\Admin\\Desktop\\New folder\\flow\\node_modules\\which\\which.js:89:16\n' +
gyp verb `which` failed     '    at C:\\Users\\Admin\\Desktop\\New folder\\flow\\node_modules\\isexe\\index.js:42:5\n' +
gyp verb `which` failed     '    at C:\\Users\\Admin\\Desktop\\New folder\\flow\\node_modules\\isexe\\windows.js:36:5\n' +
gyp verb `which` failed     '    at FSReqCallback.oncomplete (fs.js:158:21)',
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Users\Admin\Anaconda3\python.EXE
gyp verb check python version `C:\Users\Admin\Anaconda3\python.EXE -c "import platform; print(platform.python_version());"` returned: "3.7.4\r\n"
gyp verb could not find "C:\Users\Admin\Anaconda3\python.EXE". checking python launcher
gyp verb could not find "C:\Users\Admin\Anaconda3\python.EXE". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Users\Admin\Anaconda3\python.EXE", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\Admin\Desktop\New folder\flow\node_modules\node-gyp\lib\configure.js:492:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\Admin\Desktop\New folder\flow\node_modules\node-gyp\lib\configure.js:517:16)
gyp ERR! stack     at C:\Users\Admin\Desktop\New folder\flow\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:158:21)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Admin\\Desktop\\New folder\\flow\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\Admin\Desktop\New folder\flow\node_modules\node-sass
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN @angular/animations@6.0.4 requires a peer of @angular/core@6.0.4 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.9.0 (node_modules\node-sass):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.9.0 postinstall: `node scripts/build.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

audited 21851 packages in 15.679s
found 388 vulnerabilities (12 low, 25 moderate, 349 high, 2 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

由於我是新的 Angular 學習者,我無法理解錯誤信息? 我可以在家里的其他筆記本電腦上運行該程序,但不能在我的辦公室電腦上運行? 請幫助我知道問題出在哪里,我該如何解決?

編輯:我也試過npm install --global windows-build-tools但我得到了這個結果,似乎它停止工作了:

> windows-build-tools@5.2.2 postinstall C:\Users\Admin\AppData\Roaming\npm\node_modules\windows-build-tools
> node ./dist/index.js



Downloading python-2.7.15.amd64.msi
[>                                            ] 0.0% (0 B/s)
Downloaded python-2.7.15.amd64.msi. Saved to C:\Users\Admin\.windows-build-tools\python-2.7.15.amd64.msi.
Downloading vs_BuildTools.exe
[>                                            ] 0.0% (0 B/s)
Downloaded vs_BuildTools.exe. Saved to C:\Users\Admin\.windows-build-tools\vs_BuildTools.exe.

Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!

Status from the installers:
---------- Visual Studio Build Tools ----------
Still waiting for installer log file...
------------------- Python --------------------
Successfully installed Python 2.7                   

嘗試將此模塊安裝在 Windows 中。 要在 windows 10 上安裝 node-sass,您可能需要安裝 windows-build-tools

https://github.com/felixrieseberg/windows-build-tools

在終端中運行以下命令

npm install --global windows-build-tools

並嘗試npm install

@Hasani,正如您提到的,您無法在辦公室計算機上運行該項目是因為您的辦公室計算機在代理下,您應該設置代理以訪問 NPM

您的錯誤消息說要配置代理在這里

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

這就是你可以做的。

對於 HTTP

npm config set proxy http://proxy_host:port

適用於 HTTPS

如果有,則使用 https 代理地址

npm config set https-proxy https://proxy.company.com:8080

如果你有密碼和用戶名要輸入,你可以試試這個

npm config set https-proxy http://<username>:<password>@proxy<COMPANYDOMAIN.COM>.com:8080 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM