npm i安装包依赖时 gyp ERR! stack Error: Can‘t find

报错内容

gyp verb ensuring that file exists: C:Python27python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.

gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:Python27python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (E:codemydyhvue-admin-pro-master
ode_modules
ode-gyplibconfigure.js:484:19)
gyp ERR! stack     at PythonFinder. (E:codemydyhvue-admin-pro-master
ode_modules
ode-gyplibconfigure.js:509:16)
gyp ERR! stack     at callback (E:codemydyhvue-admin-pro-master
ode_modulesgraceful-fspolyfills.js:289:20)
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:183:21)
gyp ERR! System Windows_NT 10.0.19042
gyp ERR! command "D:ProgramFilesnodejsnode.exe" "E:codemydyhvue-admin-pro-masternode_modulesnode-gypbinnode-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd E:codemydyhvue-admin-pro-master
ode_modules
ode-sass
gyp ERR! node -v v14.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modulesfsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.12.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.12.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
 
npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersuserAppDataRoaming
pm-cache_logs2021-05-13T10_26_43_202Z-debug.log

解决

方式一:安装python解决(正确配置系统环境变量),python(v2.7 recommended, v3.x.x is not supported) - 推荐
下载:http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi

自行下载
npm install --python=python2.7 #先下载
npm config set python python2.7 #再设置环境

方式二:先用管理员身份打开cmd - 推荐

清除npm缓存 npm cache clean --force
1.安装 npm install -g node-gyp
2.安装 npm install --global --production windows-build-tools
-报错加版本号
2.1 npm install --global --production windows-build-tools@4.0.0

默认安装路径npm install --python=python2.7npm config set python python2.7  如果不是默认安装需要指定python位置:npm config set python phthon安装路径如npm config set python 'D:/python/python.exe'

.windows-build-tools文件夹中多了一些东西

解决

①执行npm命令npm install --global --production windows-build-tools@4.0.0
②当命令行界面开始不动时,打开任务管理器,把Build Tools结束任务(因为我没有找到BuildTolls_Full.exe)。
③再打开.windows-build-tools文件夹中的build-tools-log.txt,添加Variable: IsInstalled = 1,保存,关闭。

再看PowerShell界面

展开阅读全文

页面更新:2024-03-13

标签:缓存   版本号   路径   环境变量   界面   命令   正确   管理员   方式   文件

1 2 3 4 5

上滑加载更多 ↓
推荐阅读:
友情链接:
更多:

本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828  

© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号

Top