引入一个别人的vue项目||Error: Can't find Python executable "python", you can set the PYT HON env variable.

开始的时候引入别人的一个项目,vscode终端安装依赖,当安装node-sass时报这个错误,说没有python编译环境。
解救自己的步骤:
1.执行命令安装Python(安装了Yarn才可使用yarn命令)
执行 npm install -g node-gyp网上说先安装这个编译 C++ 扩展用的。

npm install --global --production windows-build-tools

yarn global add --production windows-build-tools
结果:安装成功
安装完成CTRL+C退出

2.执行命令安装node-sass指定版本(不输入版本号默认最新版,提示我安装4.11.0)
npm install node-sass@4.11.0

yarn add node-sass@4.11.0
结果:提示找不到python,配置配置环境变量,将node-sass卸载 npm uninstall node-sass或则删除所有的依赖重新再来

3.卸载python,重新安装(默认就行)并将新地址配置环境变量配置Path
4. npm i 继续依赖安装完成
5. npm run dev 编译启动OK

补充
设置淘宝镜像:
npm get registry
npm config set registry http://registry.npm.taobao.org/

停止终端的命令:
在node环境,快捷键:ctrl + c

在ssh环境,输入指令:exit

在git环境,快捷键:q
参考地址:
https://www.jianshu.com/p/92afe92db99f
https://blog.csdn.net/luxiangy1314/article/details/105719772
https://blog.csdn.net/m0_49230198/article/details/117863312

posted @ 2022-03-22 12:11  燃烧的竹子  阅读(304)  评论(0编辑  收藏  举报