How to install and run lessc on top of node.js and Windows?

£可爱£侵袭症+ 提交于 2019-12-03 10:17:43
curious1

In a console, run the following:

node C:\Users\Me\AppData\Roaming\npm\node_modules\less\bin\lessc style.less > style.css

style.less must be in the console's directory.

to get lessc working you have to add

C:\Users\Me\AppData\Roaming\npm

to the path

I guess you could add the bin folder in system properties -> advanced ->environment variables and append the whole path to the bin folder by edited the Path variable.

step 1: npm install less -g

step 2: npm i less --save-dev

If you just installed node.js, the windows PATH variable won't be updated within any running CMD windows. Try closing CMD and reopening it!

If you are using windows, don't forget to open the command line console as an administrator.

Ravindra

After spending around number of hours hunting around to compile less files, I got very simple answer:

  1. download node-v0.10.26-x64.msi for windows users -> install it -> then
  2. go to any folder(in command prompt) where *.less files are located and run the command "lessc styles.lsss > styles.css". (Example: in command prompt, less is my less folder where *.less files exist) D:\less>lessc styles.less > styles.css
  3. now you will get styles.css files created automatically. Open and see styles.css file

Well, you must have NodeJS installed on your machine, use this link to download and install it.

Once installed make sure to restart your machine. Then check whether it is properly installed by running "node -v" and "npm -v" in CMD.

Once that is done run "npm install less -g" and you are ready to compile your less files.

Just go into the directory where your files are and run "lessc style.less style.css"

More can be found on this link.

I fixed this issue by using Node Version Manager (nvm) to install and use the latest version of Node.js

nvm install latest
nvm use 12.4.0

After that I navigated to my project folder and typed:
npm install less -g and then
npm i less --save-dev

Finally I typed lessc less/index.less css/index.css to compile my less.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!