node-sass报错

node-sass报错

解决方案

有几种解决方案,但感觉都是为了下载vsta_sdk这个工具的。

有的电脑下载C++开发程序时可以顺带下载这个插件。

可以直接下载VS之后点击下载C++桌面开发,但是有的不行,所以网上也就有另外一种方式,就是下载VS build工具也就是这个vs_BuildTools

也有去GitHub去看官方的,https://github.com/nodejs/node-gyp#on-windows下载C++工具。

我是试了前面三个都不行,之后下载Microsoft Visual Studio Tools for Applications才解决。

下面推荐四种解决方式。

npm ERR! code 1
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Testing binary
npm ERR!     at Module._extensions..node (node:internal/modules/cjs/loader:1464:18)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:1205:32)
npm ERR!     at Module._load (node:internal/modules/cjs/loader:1021:12)
npm ERR!     at Module.require (node:internal/modules/cjs/loader:1230:19)
npm ERR!     at require (node:internal/modules/helpers:179:18)
npm ERR!     at module.exports 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'D:\\software\\nodejs\\node.exe',
npm ERR! gyp verb cli   
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@8.4.1
npm ERR! gyp info using node@21.7.3 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb find Python Python is not set from command line or npm configuration
npm ERR! gyp verb find Python Python is not set from environment variable PYTHON
npm ERR! gyp verb find Python checking if "python3" can be used
npm ERR! gyp verb find Python - executing "python3" to get executable path
npm ERR! gyp verb find Python - "python3" is not in PATH or produced an error
npm ERR! gyp verb find Python checking if "python" can be used
npm ERR! gyp verb find Python - executing "python" to get executable path
npm ERR! gyp verb find Python - executable path is "D:\software\Python312\python.exe"
npm ERR! gyp verb find Python - executing "D:\software\Python312\python.exe" to get version
npm ERR! gyp verb find Python - version is "3.12.3"
npm ERR! gyp info find Python using Python version 3.12.3 found at "D:\software\Python312\python.exe"
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 21.7.3
npm ERR! gyp verb command install [ '21.7.3' ]
npm ERR! gyp verb install input version string "21.7.3"
npm ERR! gyp verb install installing version: 21.7.3
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 21.7.3
npm ERR! gyp verb build dir "build" dir needed to be created? Yes
npm ERR! gyp verb find VS msvs_version not set from command line or npm config
npm ERR! gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp verb find VS checking VS2022 (17.9.34728.123) found at:
npm ERR! gyp verb find VS "D:\software\Microsoft\VisualStudio\Community"
npm ERR! gyp verb find VS - found "Visual Studio C++ core features"
npm ERR! gyp verb find VS - missing any VC++ toolset
npm ERR! gyp verb find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp verb find VS looking for Visual Studio 2015
npm ERR! gyp verb find VS - not found
npm ERR! gyp verb find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS checking VS2022 (17.9.34728.123) found at:
npm ERR! gyp ERR! find VS "D:\software\Microsoft\VisualStudio\Community"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - missing any VC++ toolset
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error

管理nodejs版本工具

下载nvm:https://github.com/coreybutler/nvm-windows/releases

查看源码:https://github.com/nvm-sh/nvm

最终解决方案

网络搜索Microsoft Visual Studio Tools for Applications 2019或者Microsoft Visual Studio Tools for Applications 2017

我试过2019版本和2017版本,之后将node调成16.20.2,并将Python改为最新我的Python版本为3.12.2。之后就可以了。

环境要求:
  1. node:16.20.2
  2. python:3.12.2
  3. 微软Microsoft Visual Studio Tools for Applications

2019版本下载:Microsoft Visual Studio Tools for Applications 2019

2017版本下载:Microsoft Visual Studio Tools for Applications 2017

点击下载即可。

在这里插入图片描述

解决方案一

下载VS之后选择C++桌面开发。

  1. node:16.20.2
  2. python:3.12.2和Python27

在这里插入图片描述

解决方案二

  1. node:16.20.2
  2. python:3.12.2和Python27
  3. 下载VS Build工具

VS编译工具下载地址:https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools/

在这里插入图片描述

在应用中可以找到这个生成工具。

在这里插入图片描述

解决方案三

官方的,但是是解决node-gyp。

地址:https://github.com/nodejs/node-gyp#on-windows

针对Windows和其它操作系统,有兴趣了解下。

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/635774.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

第63天:服务攻防-框架安全CVE 复现DjangoFlaskNode.JSJQuery

目录 思维导图 案例一:JavaScript-开发框架安全-Jquery&Node node.js目录穿越 CVE-2021-21315命令执行 Jquery CVE-2018-9207 案例二:Python-开发框架安全-Django&Flask django cve_2019_14234 CVE-2021-35042 flask ssti 思维导图 案…

修复vite中使用react提示Fast refresh only works when a file only exports components.

前言 我通过 vite 构建了一个 react 应用并使用 react.lazy 来懒加载组件,但是在使用过程中 一直提示 Fast refresh only works when a file only exports components. Move your component(s) to a separate file.eslint(react-refresh/only-export-components)。…

学习空间转换-3D转换

1.什么是空间转换? 使用的是transform属性实现元素在空间内的位移,旋转,缩放等效果。 空间:是从坐标轴角度定义的。x,y,z三条坐标轴构成的一个立体空间,Z轴位置与视线方向相同。 所以空间转换也被叫做3D转换 语法&a…

排序算法集合

912. 排序数组 趁着这道题总结下排序方法 1.快速排序 算法描述 1.从数列中挑出一个元素,称为"基准"(pivot), 2.重新排序数列,所有比基准值小的元素摆放在基准前面,所有比基准值大的元素摆在基…

为什么用云渲染农场?3D云渲染农场助力影视动画行业发展

​计算机图形技术的进步使得3D渲染成为多个产业发展的重要推动力。设计师和艺术家利用这项技术将创意实现,创造出震撼的视觉作品。但是,高质量的渲染需要大量的计算资源。云渲染农场通过提供这些资源,有效提高了渲染的速度和效率,…

精致摄影网站模板 Bootstrap4

目录 一.前言 二.展示 三.下载链接 一.前言 这是一个相机摄影网站。网站结构包括以下部分: 导航栏部分:位于页面顶部,包含了Logo和若干导航链接,如Home、About、Gallery、Services、Testimonial和Contact。 横幅部分&#xff…

接口测试相关

接口测试,接口 接口是数据交互的入口和出口 接口是一套规范和标准 统一设计标准 前后端相对独立 扩展型灵活 接口文档。 接口测试 接口测试环境,运行程序,自己搭建环境 接口测试插件 谷歌postman 火狐 restclient java测试工具为j…

使用PHP开发体育赛事直播平台,有这些缺点和优点

"东莞梦幻网络科技"作为体育直播平台开发领域的领导者,选择使用PHP开发体育赛事直播平台的现成源码,为什么会选择该语言,背后的选择理由可以从该技术的优点和缺点中找到答案。 一、优点1、易学易用与快速开发:PHP语言语…

【python】使用python和selenium实现某平台自动化上传作品的全步骤

第一,我们需要下载python并安装 下载地址:https://www.python.org/downloads/release/python-3123/ 3.x版本的python自带pip工具,因此不需要额外下载。 ModuleNotFoundError: No module named seleniumpip用于下载python适用的各类模块&…

抖音abogus(收部Pixel2手机退坑的dd我走咸鱼淘宝)

声明 本文章中所有内容仅供学习交流使用,不用于其他任何目的,抓包内容、敏感网址、数据接口等均已做脱敏处理,严禁用于商业用途和非法用途,否则由此产生的一切后果均与作者无关!wx a15018601872 本文章未…

IDEA插件:CodeGeex

前言 CodeGeeX是由清华大学和智谱AI联合开发的多语言代码生成模型。CodeGeeX是一款AI编程助手,其功能类似于Github Copilot、Codeium、CodeWhisperer、Bito等智能编程助手。CodeGeeX支持Python、C、Java、JavaScript、Go等10多种主流编程语言。它可以帮助程…

【nvm最新解决方案】Node.js v16.20.2 is not yet released or available

【nvm最新解决方案】Node.js v16.20.2 is not yet released or available 解决办法:下载想安装的node压缩包,放入nvm对应目录。 2024年最新node压缩包地址:https://nodejs.org/dist/ 1、选择对应的node版本:例如,我选的…