Error: Can‘t find Python executable “python“

278 阅读1分钟

Error: Can‘t find Python executable “python“, you can set the PYTHON env variable

checking for python executable "python2" in the path

企业微信截图_6f5fec03-d15f-4ae6-b8d6-fd6c344bd577.png

安装依赖失败问题

背景: 一个旧的gulp项目,node版本使用的10,在安装依赖的时候一直安装失败,报图上的错误。 经过各种尝试 重新安装python2,python3,配置python的环境变量等等方式,均以失败告终。 后来通过google查询,最终找到了解决方案,方案如下:

1、不重新安装配置 python 2

2、不更新 npm 安装源

3、进行 install 时不执行忽略构建脚本

npm install node-sass --ignore-scripts
npm install --ignore-scripts
npm install

到此依赖安装就成功了。

接下来启动项目时又遇到了问题

 "scripts": {
    "dev": "./node_modules/gulp/bin/gulp.js",
    "build": "gulp dist",
    "upload": "node build/upload.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },

启动项目失败问题

sudo npm run dev时遇到的报错如下:

1、error in ./src/components/Breadcrumb/index.vue?vue&type=style&index=0&id=b50ef614&rel=stylesheet%2Fscss&lang=scss&scoped=true&

Module build failed (from ./node_modules/sass-loader/lib/loader.js): Error: ENOENT: no such file or directory, scandir 'U:\cnblogs\fanfengping-dtops\fanfengping-dtops-front\node_modules\node-sass\vendor' at Object.readdirSync (fs.js:955:3)

// 解决方案:执行如下命令,重新编译构建一下 node-sass 即可。
npm rebuild node-sass

2、Assertion `args[1]->IsString()' failed.

 // 解决方案:执行下面的命令
 npm install natives

gulp项目启动成功后浏览器无法访问问题

现象

企业微信截图_1cc1b401-32f1-4f4e-a20b-2cfbd2b173de.png

gulp启动后命令行中的样式

企业微信截图_b52f4c00-304e-4381-b9b5-b7dc36e743c1.png

解决方案 将gulp-connect 升级到5.7.0

到此整个项目就跑起来了,希望我遇到的这些报错整理,会对你有所帮助!感谢阅读,♥️