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

2019-03-24 05:23发布

Hi I am learning LESS and I would like to install lessc on my Windows 7.

Following this tutorial http://verekia.com/less-css/dont-read-less-css-tutorial-highly-addictive

The first step is I dowloaded and installed node.js (node-v0.10.5-x64.msi).

Then in a console, I ran

npm install less -g

I got the following:

npm http GET https://registry.npmjs.org/less
npm http 304 https://registry.npmjs.org/less
npm http GET https://registry.npmjs.org/ycssmin
npm http 304 https://registry.npmjs.org/ycssmin
C:\Users\Me\AppData\Roaming\npm\lessc -> C:\Users\Me\AppData\Roaming\npm\node_modules\less\bin\lessc
less@1.3.3 C:\Users\Me\AppData\Roaming\npm\node_modules\less
+-- ycssmin@1.0.1

Then I ran the following in the same console:

lessc style.less > style.css

But I got

'lessc' is not recognized as an internal or external command, operable program or batch file.

I am not sure where I got wrong. I googled but it seems there is too much stuff, not sure which one is right. Did many tests without any success.

Could someone tell me how to do it or give me a pointer to some place with detailed and latest install info for Windows?

8条回答
迷人小祖宗
2楼-- · 2019-03-24 05:46

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.

查看更多
Animai°情兽
3楼-- · 2019-03-24 05:48

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!

查看更多
登录 后发表回答