安装了vs2019 编译node-sass node-gyp 找不到编译器的解决方法
1 新建powershell脚本文件
- <#
- This is a workaround for "node-gyp is unable to find msbuild if VS2019 is installed"
- https://github.com/nodejs/node-gyp/issues/1663
- It create a shim EXE as "MSBuild\15.0\Bin\MSBuild.exe" to target "MSBuild\Current\Bin\MSBuild.exe"
- By noseratio - MIT license - use at your own risk!
- It requires admin mode, I use wsudo/wsudox (https://chocolatey.org/packages/wsudo) for that:
- wsudo powershell -f make-msbuild-shim.ps1
- #>
- #Requires -RunAsAdministrator
- #Requires -Version 5.1
- $ErrorActionPreference = "Stop"
- $vsBasePath = . "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
- -latest `
- -requires Microsoft.Component.MSBuild `
- -property installationPath -format value
- if (!$vsBasePath) {
- throw "VS2017+ must be installed"
- }
- $msbuildSimPath = [System.IO.Path]::Combine($vsBasePath, "MSBuild\15.0\Bin\MSBuild.exe")
- if ([System.IO.File]::Exists($msbuildSimPath)) {
- Write-Host "Already exists: $msbuildSimPath"
- exit 0;
- }
- # Create the shim .EXE using C#
- $code = @"
- using System;
- using System.Diagnostics;
- using System.IO;
- using System.Linq;
- static class MSBuildShim
- {
- static void Main()
- {
- var thisExe = Process.GetCurrentProcess().MainModule.FileName;
- var thisExeDir = Path.GetDirectoryName(thisExe);
- var newExe = Path.GetFullPath(Path.Combine(thisExeDir, "..\\..\\Current\\Bin", "MSBuild.exe"));
- if (!File.Exists(newExe))
- throw new FileNotFoundException(newExe);
- var process = new Process();
- process.StartInfo.FileName = newExe;
- process.StartInfo.Arguments = String.Join("\u0020", Environment.GetCommandLineArgs().Skip(1));
- process.StartInfo.UseShellExecute = false;
- if (!process.Start())
- throw new InvalidOperationException(newExe);
- process.WaitForExit();
- Environment.ExitCode = process.ExitCode;
- }
- }
- "@
- Add-Type -TypeDefinition $code `
- -OutputType ConsoleApplication `
- -OutputAssembly "$msbuildSimPath" `
- -ReferencedAssemblies "System.Core.dll"
- Write-Host "Shim created at: $msbuildSimPath"
2 打开powershell 执行脚本 生成垫片程序
如果提示禁止执行脚本 则执行 set-executionpolicy remotesigned
附:npm install --global --production windows-build-tools 这个不太好使且只支持2015 2017
参考 :1 http://continuousdeveloper.com/2019/04/09/node-gyp-with-visual-studio-2019/
2 https://blog.csdn.net/ebzxw/article/details/85019887
安装了vs2019 编译node-sass node-gyp 找不到编译器的解决方法的更多相关文章
- Sublime2编译Python程序EOFError:EOF when reading a line解决方法【转】
在Sublime2中编译运行Python文件时,如果代码中包含用户输入的函数时(eg. raw_input()),Ctrl+b编译运行之后会提示以下错误: 解决方法:安装SublimeREPL打开Su ...
- 【pycharm】pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法
pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法 解决方法: 在pycharm的安装目 ...
- Win7,Win8安装ArcGIS软件或Node.js等安装包出现2503错误的解决方法
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZXNyaWNoaW5hY2Q=/font/5a6L5L2T/fontsize/400/fill/I0JBQk ...
- k-vim安装及The ycmd server SHUT DOWN (restart with ':YcmRestartServer')这种错误的解决方法
vim配置 下载地址:https://github.com/wklken/k-vim 安装步骤: 1. clone 到本地 git clone https://github.com/wklken/k- ...
- 安装redis出现cc adlist.o /bin/sh:1:cc:not found的解决方法
安装redis时 提示执行make命令时提示 CC adlist.o /bin/sh: cc: 未找到命令 问题原因:这是由于系统没有安装gcc环境,因此在进行编译时才会出现上面提示,当安装好gc ...
- 解决安装VC6.0后出现MSDEV.EXE错误,无法用打开工程解决方法
问题:安装VC6.0后,在打开项目或添加文件时,出现如下错误: 可能导致原因:由于Ms安装软件的兼容性问题,导致VC6.0安装不完全, 解决方法:--网上打sp6补丁的方法貌似不可用,所以可以采用另一 ...
- Centos7安装完毕后重启提示Initial setup of CentOS Linux 7 (core)的解决方法
问题: CentOS7安装完毕,重新开机启动后显示: Initial setup of CentOS Linux 7 (core) 1) [x] Creat user 2) [!] License i ...
- mac os x 安装mysql遇到 Access denied for user 'root'@'localhost' (using password: YES)的解决方法
最近把开发环境迁移到macbook上,装上mysql启动之后,连接,总是报这个错误.5.5的版本默认密码为空.其实这个错误是root未授权的问题.解决方法如下: 未给localhost root用户授 ...
- php5.3.*编译出现make: *** [ext/gd/libgd/gd_compat.lo] Error 1 解决方法
升级系统,把php5.2.9升级到5.3.6,按照以前的编译参数,configure能正常通过,但是在make的时候提示: In file included from /root/php-5.3.6 ...
随机推荐
- 打开远程桌面时总提示无法打开连接文件default.rdp
删除C:\Users\Administrator\Documents\default.rdp,再启动远程就好了 http://www.chahushequ.com/read-topic-94-2fa9 ...
- 自动化应用一键部署卸载&持续构建测试与交付
1.代码仓库:版本控制Gitlab Gitlab后台管理开发视角Gitlab的应用运维视角Gitlab的应用Gitlab本地使用 2.批量部署交付工具:Ansible Ansible虚拟环境构建Ans ...
- 子系统安装nginx
Win10中启用WSL WSL是微软和Canonical合作为开发人员提供的一个运行在win10环境下的一个Linux子系统,由微软编写核心代码,并由Canonical提供软件包的支持.要想使用WSL ...
- Python学习之==>操作MySQL
一.简介: MySQL为关系型数据库,其他关系型数据库包括Oracle.DB2.Sql Server等等.Python操作MySQL需要使用到pymsyql模块,pip安装即可. 二.操作MySQL步 ...
- Delphi 判断按键状态
Delphi 判断按键状态 http://blog.sina.com.cn/s/blog_54da9cc001015di1.html (2012-04-05 14:22:50) 标签: 杂谈 分类: ...
- Windows命令集锦
1.用于私网的IP地址段: 10.0.0.0/8: 10.0.0.0-10.255.255.255 172.16.0.0/12: 172.16.0.0-172.31.255.255 192.168.0 ...
- C# sqlite 无法识别的datetime格式 FromOADate
再读取不可控数据库datetime字段时,遇到了一个奇葩问题——“无法识别的datetime格式” 搞了半天…… 数据库里看:2017-06-06 10:28:30.000 不做处理查询报错:“无法识 ...
- yield(),sleep()以及wait()的区别
往往混淆了这三个函数的使用. 从操作系统的角度讲,os会维护一个ready queue(就绪的线程队列).并且在某一时刻cpu只为ready queue中位于队列头部的线程服务. 但是当前正在被服务的 ...
- Matlab——图形绘制——三维立体图形 剔透玲珑球 动态图——彗星状轨迹图
三维绘图函数 三维绘制工具 函数view 实例:三维螺旋线 >> t=:pi/:*pi; plot3(sin(t),cos(t),t) grid %添加网格 plot3可以画出空间中的曲 ...
- Web测试常用的链接测试工具
1.Xenu Link Sleuth 详细解说地址:http://home.snafu.de/tilman/xenulink.htm http://pan.baidu.com/s/1qY3Tp4C(英 ...