如果提示是node_gyp报错,找不到python,可能是我们的python环境美配置好
报错信息:
Error: Can't find Python executable "python", you can set the PYTHON env variable
解决方案
//安装gyp npm install -g node-gyp //配置依赖 npm config set python python2.7 npm config set msvs_version 2015
遇到问题访问https://github.com/nodejs/node-gyp
配置python环境变量后,报错信息改变
Command "/Library/Frameworks/Python.framework/Versions/3.5/bin/python3 -u -c "import setuptools
这个先不管,这时候看到package.json里依赖的node_sass版本是6.0.1,于是运行npm install node-sass@6.0.1
依旧有node-gyp报错,但是看到有另一个信息
node-sass@6.0.1 postinstall: `node scripts/build.js`
于是尝试
cnpm uninstall node-sass (如果提示cnpm 命令不存在,先换源:npm set registry https://registry.npm.taobao.org/ 再下载安装:npm install -g cnpm --registry=https://registry.npm.taobao.org )
cnpm install node-sass@4.14.1
最后nom install
然后就输入 npm run serve / npm run dev 运行
到现在依旧不明白项目为什么能起来和为什么不能起来,玄学大法好



