嘎!stack 错误:找不到 Python 可执行文件"C:UsersAdminAnaconda3python.EXE",可以设置 PYTHON env 变量



我从github下载了一个项目,并在我的应用程序中尝试了npm install,但我得到了以下错误结果:

> node-sass@4.9.0 install C:UsersAdminDesktopNew folderflownode_modulesnode-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:UsersAdminDesktopNew folderflownode_modulesnode-sass
> node scripts/build.js
Building: C:Program Filesnodejsnode.exe C:UsersAdminDesktopNew folderflownode_modulesnode-gypbinnode-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:UsersAdminDesktopNew folderflownode_moduleswhichwhich.js:13:12)
gyp verb `which` failed     at F (C:UsersAdminDesktopNew folderflownode_moduleswhichwhich.js:68:19)
gyp verb `which` failed     at E (C:UsersAdminDesktopNew folderflownode_moduleswhichwhich.js:80:29)
gyp verb `which` failed     at C:UsersAdminDesktopNew folderflownode_moduleswhichwhich.js:89:16
gyp verb `which` failed     at C:UsersAdminDesktopNew folderflownode_modulesisexeindex.js:42:5
gyp verb `which` failed     at C:UsersAdminDesktopNew folderflownode_modulesisexewindows.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:UsersAdminDesktopNew folderflownode_moduleswhichwhich.js:13:12)
gyp verb `which` failed     at F (C:UsersAdminDesktopNew folderflownode_moduleswhichwhich.js:68:19)
gyp verb `which` failed     at E (C:UsersAdminDesktopNew folderflownode_moduleswhichwhich.js:80:29)
gyp verb `which` failed     at C:UsersAdminDesktopNew folderflownode_moduleswhichwhich.js:89:16
gyp verb `which` failed     at C:UsersAdminDesktopNew folderflownode_modulesisexeindex.js:42:5
gyp verb `which` failed     at C:UsersAdminDesktopNew folderflownode_modulesisexewindows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:158:21) {
gyp verb `which` failed   stack: 'Error: not found: python2n' +
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:16n' +
gyp verb `which` failed     '    at C:\Users\Admin\Desktop\New folder\flow\node_modules\isexe\index.js:42:5n' +
gyp verb `which` failed     '    at C:\Users\Admin\Desktop\New folder\flow\node_modules\isexe\windows.js:36:5n' +
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:UsersAdminAnaconda3python.EXE
gyp verb check python version `C:UsersAdminAnaconda3python.EXE -c "import platform; print(platform.python_version());"` returned: "3.7.4rn"
gyp verb could not find "C:UsersAdminAnaconda3python.EXE". checking python launcher
gyp verb could not find "C:UsersAdminAnaconda3python.EXE". guessing location
gyp verb ensuring that file exists: C:Python27python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:UsersAdminAnaconda3python.EXE", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:UsersAdminDesktopNew folderflownode_modulesnode-gyplibconfigure.js:492:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:UsersAdminDesktopNew folderflownode_modulesnode-gyplibconfigure.js:517:16)
gyp ERR! stack     at C:UsersAdminDesktopNew folderflownode_modulesgraceful-fspolyfills.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:UsersAdminDesktopNew folderflownode_modulesnode-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_modulesfsevents):
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_modulesnode-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:UsersAdminAppDataRoamingnpmnode_moduleswindows-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:UsersAdmin.windows-build-toolspython-2.7.15.amd64.msi.
Downloading vs_BuildTools.exe
[>                                            ] 0.0% (0 B/s)
Downloaded vs_BuildTools.exe. Saved to C:UsersAdmin.windows-build-toolsvs_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上安装节点sass,您可能需要安装windows构建工具

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 

最新更新