当前位置: 首页 > news >正文

NPM【问题 01】npm i node-sass@4.14.1报错not found: python2及Cannot download问题处理

node-sass安装问题处理

  • 1.问题
  • 2.处理
    • 2.1 方案一【我的环境失败】
    • 2.2 方案二【成功】
    • 2.3 方案三【成功】

1.问题

  • gyp verb which failed Error: not found: python2
# 1.添加Python27的安装路径到环境变量
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2# 2.未按照配置的环境变量找到python2
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python E:\anaconda3\envs\python.EXE

真实原因:

  • Cannot download “https://github.com/sass/node-sass/releases/download/version/x.node”
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-83_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-83_binding.node"

2.处理

2.1 方案一【我的环境失败】

# npm设置国内地址
npm config set registry https://registry.npm.taobao.org/
npm config get registry

首先确认node的版本跟node-sass的版本是匹配的 https://github.com/sass/node-sass:

image.png

# 查询node版本
node -v# 查询结果
v14.17.0
{..."node-sass": "4.14.1","sass-loader": "8.0.2",...
}

解决方法,原文链接:https://blog.csdn.net/manonggeerdan/article/details/121260754:

# 1.删除工程的node_modules文件夹
# 2.以管理员身份打开dos窗口
# 3.安装node-gyp
npm install -g node-gyp
# 4.安装windows-build-tools
npm install --global --production windows-build-tools

这里可能出现的问题:
Visual Studio Build Tools一直处于“Still waiting for installer log file…”状态:

Status from the installers:
---------- Visual Studio Build Tools ----------
Still waiting for installer log file...
------------------- Python --------------------
Python 2.7.8 is already installed, not installing again.

【解决】不需要等待,直接ctrl+c停止,然后输入以下命令

npm install --global --production windows-build-tools --vs2015# 安装成功
Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!---------- Visual Studio Build Tools ----------
Successfully installed Visual Studio Build Tools.
------------------- Python --------------------
Python 2.7.8 is already installed, not installing again.Now configuring the Visual Studio Build Tools..All done!+ windows-build-tools@5.2.2
updated 1 package in 114.042s

然后再执行npm install

2.2 方案二【成功】

直接下载安装,复制报错信息里的地址:

Cannot download "https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-83_binding.node"
# 使用腾讯的云服务器进行下载
wget https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-83_binding.node

image.png
虽然很慢但是最终下载成功了!然后执行以下命令进行安装:

npm i node-sass@4.14.1 --sass_binary_site=E:\yuanzheng-codebase\code-gitee-open\open_ruoyi_activiti\ruoyi-deploy\ -D
  • -D 标志表示将 node-sass 安装为开发依赖项。

网盘文件分享:

链接:https://pan.baidu.com/s/1u72IgICc6EAlT4gAAr1gzg?pwd=bflf

2.3 方案三【成功】

npm i node-sass@4.14.1 --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/ -D
http://www.lryc.cn/news/208835.html

相关文章:

  • redis集群中节点fail,noaddr
  • Fourier分析导论——第1章——Fourier分析的起源(E.M. Stein R. Shakarchi)
  • 使用Node.js软件包管理器(npm)安装TypeScript
  • 鸿蒙ArkUI-X跨端应用开发,一套代码构建多平台应用
  • 【鸿蒙软件开发】ArkTS基础组件之Gauge(环形图表)、LoadingProgress(动态加载)
  • C++模板类用作参数传递
  • SQL server 代理服务启动和查看
  • 单例模式详解【2023年最新】
  • 读高性能MySQL(第4版)笔记21_读后总结与感想兼导读
  • 放学辣[简单版]
  • 面向对象设计——原型模式
  • SpringAOP源码解析之advice执行顺序(三)
  • CentOS 安装 tomcat 并设置 开机自启动
  • 论文阅读——ELECTRA
  • Android开发知识学习——HTTP基础
  • 51单片机的hello world之点灯
  • Django 实战开发(一)项目搭建
  • Unity把余弦值转成弧度和角度
  • debian、ubuntu打包deb包工具,图形界面deb打包工具mkdeb
  • 微信小程序如何使用地球半径计算两组经纬度点之间的距离(自身位置与接口返回位置)【上】
  • postgis ST_ClipByBox2D用法
  • 【MyBatis Plus】深入探索 MyBatis Plus 的条件构造器,自定义 SQL语句,Service 接口的实现
  • 基于AI与物联网技术的智能视频监控系统架构剖析
  • mysql 基础知识
  • Flink CDC 2.0 主要是借鉴 DBLog 算法
  • win10 + VS2017 编译libjpeg(jpeg-9b)--更新
  • 使用pycharm远程调试
  • rust学习
  • GCC、g++、gcc的关系
  • IP应用场景API的反欺诈潜力:保护在线市场不受欺诈行为侵害