在下载一个新项目时运行:npm run install 发现报错 npm uninstall 异常
Error: Could not find any Visual Studio installation to use
或是
-------------------------
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 install --global --production windows-build-tools
在install 如果没有效果,下载 https://visualstudio.microsoft.com/zh-hans/downloads/ 新版 visual studio
目前最新是 visual studio Community 2022 ,勾选c++,安装完成后
运行:npm config set msvs_version=2022
重新install 基本上可以成功了。
选择dart-sass的理由 官网
删除node-sass 安装sass
npm install node-sass
npm install sass -D
nuxt项目异常提示: You did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing. Pick plugins for your case on https://www.postcss.parts/ and use them in postcss.config.js.
解决方案
npm i -D @nuxt/postcss8 @nuxtjs/style-resources
在nuxt.config.js中添加配置
buildModules: ['@nuxtjs/style-resources','@nuxt/postcss8',
],
下一篇:C++模板初阶