安装好node之后,打开运行-->cmd-->进入安装node的文件夹目录-->输入 npm install -g less.
然后自动就会在C:\Users\Administrator\AppData\Roaming\npm\node_modules这个目录下安装好less了。
注意:a) 不能直接用node.exe来直接npm 安装哦,这样会抛出 npm should be run outside of the node repl, in your normal shell 这个错误的哟。
也就是如果要运行类似 npm的命令,需要在系统的shell中,比如windows的cmd。node自带的那个叫repl,不能在其中运行npm命令,只能运行js。
b)
2.设置
在webstorm里面:文件(file) --> 设置(settings) --> 工具(Tools) --> File Watchers -->点击右上方的“+”加号按钮,然后选择less
然后
第二个arguments是设置是否压缩css的,如果要压缩就设置:--plugin=less-plugin-clean-css $FileName$,当然,这样也还需要安装压缩软件,cmd或nodejs的命令提示符中输入npm install -g less-plugin-clean-css。