Node.js: Python not found exception due to node-sass and node-gyp
2021/11/15 17:12:57
本文主要是介绍Node.js: Python not found exception due to node-sass and node-gyp,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Node.js: Python not found exception due to node-sass and node-gyp
回答1
so this happened to me on windows recently. I fix it by following the following steps using a PowerShell with admin privileges:
- delete
node_modules
folder - running
npm install --global windows-build-tools
with administrative privilege. (in my case need restart - and restart without ask!!!) - reinstalling node modules or node-sass with
npm install
This is exactly the right answer.
npm install --global windows-build-tools
installs Python 2.7, and installs it globally (so you don't have to re-install on a per-project basis). It fixes the "can't install SASS" problem. NOTE: On windows, you must run your npm command prompt as "Administrator".
– paulsm4
Nov 22 '18 at 22:14
回答2
The error message means that it cannot locate your python executable or binary.
In many cases, it's installed at c:\python27. if it's not installed yet, you can install it with npm install --global windows-build-tools
, which will only work if it hasn't been installed yet.
Adding it to the environment variables does not always work. A better alternative, is to just set it in the npm config.
npm config set python c:\python27\python.exe
这篇关于Node.js: Python not found exception due to node-sass and node-gyp的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-15useCallback教程:React Hook入门与实践
- 2024-11-15React中使用useContext开发:初学者指南
- 2024-11-15拖拽排序js案例详解:新手入门教程
- 2024-11-15React中的自定义Hooks案例详解
- 2024-11-14受控组件项目实战:从零开始打造你的第一个React项目
- 2024-11-14React中useEffect开发入门教程
- 2024-11-14React中的useMemo教程:从入门到实践
- 2024-11-14useReducer开发入门教程:轻松掌握React中的useReducer
- 2024-11-14useRef开发入门教程:轻松掌握React中的useRef用法
- 2024-11-14useState开发:React中的状态管理入门教程