引入一個別人的vue專案||Error: Can't find Python executable "python", you can set the PYT HON env variable.
阿新 • • 發佈:2022-03-22
開始的時候引入別人的一個專案,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 [email protected]
或
yarn add [email protected]
結果:提示找不到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