如果你的问题是这样的:
1、你想在linux 或者 mac 上通过npm run build 或者 gulp build来编译gulp 脚手架里面的less文件为css文件。
解决这个问题的方法之一,也是亲测有效的方法,这个时候可以通过降级或提高nodejs版本来实现,通过 n 或者 nvm 来调整nodejs的版本
2、你想在windows 下来达到问题1 的目的,至少在 win10上通过n 来调节nondejs版本是做不到的,
会报出如下错误:因此我的方法是在Linux上编译一遍然后copy到win桌面,然后利用启动也能达到一定的目的,但是这样比较不灵活,但你又有什么办法呢!
C:\Users\hanxiaoshun>node
Welcome to Node.js v12.16.1.
Type ".help" for more information.
> c
>
(To exit, press ^C again or ^D or type .exit)
> .exit
C:\Users\hanxiaoshun>npm install n
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for n@7.1.0: wanted {"os":"!win32","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS: !win32
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: win32
npm ERR! notsup Actual Arch: x64
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\hanxiaoshun\AppData\Roaming\npm-cache\_logs\2021-04-09T01_37_57_114Z-debug.log
本文介绍如何在Linux或Mac环境下使用npm run build或gulp build编译Gulp项目中的LESS文件为CSS,并探讨了在Windows环境下遇到的问题及解决方案。

3535

被折叠的 条评论
为什么被折叠?



