今天在新的开发环境检出nodejs的前端项目,运行npm start启动项目后报:
> Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 12.x
原因:升级了node版本,sass包和现在node版本不一致
处理:
npm uninstall node-sass
npm install node-sass
遂又遇到:
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
原因:缺少python环境
处理
第一种方式:
安装Python及环境变量配置
一定要安装python2.7的版本
环境变量安装可以参考:http://blog.csdn.net/lyj_viviani/article/details/51763101
如果第一种方式不行可以试试第二种方式。
第二种方式:
运行下面代码(以管理员身份运行cmd执行)
npm install --global --production windows-build-tools
遂遇到
Unexpected end of JSON input while parsing near **********
解决执行: `npm cache clean --force`
再次尝试,终于成功
最后再重新执行
npm uninstall node-sass
npm install node-sass
至此解决