记录:npm install出错( Can‘t find Python executable “python“, you can set the PYTHON env variable.)

  • 今天在进行renren-fast前端部署的时候,执行npm install后失败,出错如下:
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 (F:\vscode\workrome\renren\renren-fast-vue\node_modules\_node-gyp@3.8.0@node-gyp\lib\configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (F:\vscode\workrome\renren\renren-fast-vue\node_modules\_node-gyp@3.8.0@node-gyp\lib\configure.js:509:16)
gyp ERR! stack     at callback (F:\vscode\workrome\renren\renren-fast-vue\node_modules\_graceful-fs@4.2.4@graceful-fs\polyfills.js:295:20)
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:183:21)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "F:\\node\\setupPath\\node.exe" "F:\\vscode\\workrome\\renren\\renren-fast-vue\\node_modules\\_node-gyp@3.8.0@node-gyp\\bin\\node-gyp.js" "rebuild" 
"--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd F:\vscode\workrome\renren\renren-fast-vue\node_modules\_node-sass@4.13.1@node-sass
gyp ERR! node -v v14.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
[npminstall:runscript:error] node-sass@4.13.1 scripts.postinstall run "node scripts/build.js" error: Error [RunScriptError]: Run "C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js" error, exit code 1
    at ChildProcess.<anonymous> (F:\node\setupPath\node_global\node_modules\cnpm\node_modules\runscript\index.js:96:21)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1048:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) {
  stdio: [Object],
  exitcode: 1
}
× Install fail! RunScriptError: post install error, please remove node_modules before retry!
Run "C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js" error, exit code 1
RunScriptError: Run "C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js" error, exit code 1
    at ChildProcess.<anonymous> (F:\node\setupPath\node_global\node_modules\cnpm\node_modules\runscript\index.js:96:21)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1048:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
npminstall version: 3.28.0
npminstall args: F:\node\setupPath\node.exe F:\node\setupPath\node_global\node_modules\cnpm\node_modules\npminstall\bin\install.js --fix-bug-versions --china --userconfig=C:\Users\asus\.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://r.npm.taobao.org node-sass
  • 从上面看这句话Can't find Python executable "python", you can set the PYTHON env variable.,看了博客知道是少了python2.7这个环境,所以下载python2.7,并且配置了环境变量,下载和安装python2.7我是看了这位老哥的博客。https://blog.csdn.net/u013925378/article/details/83210779
  • 安装完后,我开心地又执行了一遍npm install,果然事情没有这么简单,又报了下面的错误。
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
生成启动时间为 2021/1/5 14:24:39。
节点 1 上的项目“F:\vscode\workrome\renren\renren-fast-vue\node_modules\node-sass\build\binding.sln”(默认目标)。
ValidateSolutionConfiguration:
  正在生成解决方案配置“Release|x64”。
项目“F:\vscode\workrome\renren\renren-fast-vue\node_modules\node-sass\build\binding.sln”(1)正在节点 1 上生成“F:\vscode\workrome\renren\renren-fast-vue\node_modules\node-sass
\build\binding.vcxproj.metaproj”(2) (默认目标)。
项目“F:\vscode\workrome\renren\renren-fast-vue\node_modules\node-sass\build\binding.vcxproj.metaproj”(2)正在节点 1 上生成“F:\vscode\workrome\renren\renren-fast-vue\node_modu
les\node-sass\build\src\libsass.vcxproj”(3) (默认目标)。
F:\vscode\workrome\renren\renren-fast-vue\node_modules\node-sass\build\src\libsass.vcxproj(20,3): error MSB4019: 未找到导入的项目“F:\Microsoft.Cpp.Default.props”。请
确认 <Impor
t> 声明中的路径正确,且磁盘上存在该文件。
已完成生成项目“F:\vscode\workrome\renren\renren-fast-vue\node_modules\node-sass\build\src\libsass.vcxproj”(默认目标)的操作 - 失败。

已完成生成项目“F:\vscode\workrome\renren\renren-fast-vue\node_modules\node-sass\build\binding.vcxproj.metaproj”(默认目标)的操作 - 失败。

已完成生成项目“F:\vscode\workrome\renren\renren-fast-vue\node_modules\node-sass\build\binding.sln”(默认目标)的操作 - 失败。


生成失败。

“F:\vscode\workrome\renren\renren-fast-vue\node_modules\node-sass\build\binding.sln”(默认目标) (1) ->
“F:\vscode\workrome\renren\renren-fast-vue\node_modules\node-sass\build\binding.vcxproj.metaproj”(默认目标) (2) ->
“F:\vscode\workrome\renren\renren-fast-vue\node_modules\node-sass\build\src\libsass.vcxproj”(默认目标) (3) ->
  F:\vscode\workrome\renren\renren-fast-vue\node_modules\node-sass\build\src\libsass.vcxproj(20,3): error MSB4019: 未找到导入的项目“F:\Microsoft.Cpp.Default.props”。
请确认 <Imp
ort> 声明中的路径正确,且磁盘上存在该文件。

    0 个警告
    1 个错误

已用时间 00:00:00.71
gyp ERR! build error 
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (F:\vscode\workrome\renren\renren-fast-vue\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "F:\\node\\setupPath\\node.exe" "F:\\vscode\\workrome\\renren\\renren-fast-vue\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd F:\vscode\workrome\renren\renren-fast-vue\node_modules\node-sass
gyp ERR! node -v v14.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})    

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.13.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     F:\node\setupPath\node_cache\_logs\2021-01-05T06_24_42_870Z-debug.log
  • 看了上述的报错,简单地看(
F:\vscode\workrome\renren\renren-fast-vue\node_modules\node-sass\build\src\libsass.vcxproj(20,3): error MSB4019: 未找到导入的项目“F:\Microsoft.Cpp.Default.props”。
请确认 <Imp
ort> 声明中的路径正确,且磁盘上存在该文件。

),就是少了这个文件,裂开了,我的文件夹根本就没有这个文件,怎么搞,有查了一下博客,明白了,这个是因为被墙了,文件下载不下来,还就直接报错,所以整了一下,就决定用cnpm install来安装依赖,安装cnpm百度一堆博客,我这里就不讲了,我直接就cnpm install,大功告成。

  • 以上问题就是我自己遇到的,可能并不适合每一个人,希望对需要的人有帮助。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值