python - 吉普 错误!堆栈错误 : Can't find Python executable "C:\Users\Admin\Anaconda3\python.EXE", 您可以设置 PYTHON 环境变量

标签 python angular npm

我从 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

关于python - 吉普 错误!堆栈错误 : Can't find Python executable "C:\Users\Admin\Anaconda3\python.EXE", 您可以设置 PYTHON 环境变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58834220/

相关文章:

python - MySQL "data"文件夹不断增长,即使在 DROP TABLE 之后也是如此

python - 如何在Python Django 中更新文章?

python - 如何在Python上解析网站上的特定HTML表

angular - ag-grid API 在 Angular 单元测试中未定义

node.js - 如何一次将 node_modules 中的所有依赖项添加到 package.json 中?

node.js - NPM:如何链接两个名称相同但版本不同的包?

javascript - node_modules 包如何读取项目根目录下的配置文件?

python - 使用 OpenGL,结果是否取决于安装的硬件或驱动程序?

javascript - 循环遍历不同数组中的元素

Angular - ErrorHandler 中的导航仅适用于 zone.run()