Lesscss command line compiler Lessc

点点圈 提交于 2019-12-10 13:00:53

问题


Hi Im trying to get the LessCss command line compiler installed on a Mac.

I've tried

brew install less
Error: No available formula for less

brew install lessc
Error: No available formula for lessc

sudo npm install -g less
..Installs happily..

sudo npm install -g lessc
npm http GET https://registry.npmjs.org/lessc
npm http 404 https://registry.npmjs.org/lessc
npm ERR! 404 'lessc' is not in the npm registry.

npm install less --global
..Installs happily..

npm install lessc --global
npm http GET https://registry.npmjs.org/lessc
npm http 404 https://registry.npmjs.org/lessc
npm ERR! 404 'lessc' is not in the npm registry.

and all I get is

less js/less/style.less > style-theme.css
-bash: less: command not found

lessc js/less/style.less > style-theme.css
-bash: lessc: command not found

Does anyone have any experience with this?


I found something said my path variable might be messed up. This:

/bin/echo $PATH

gets me:

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin

回答1:


the npm package name for lessc is less

try writing

sudo npm install -g less



回答2:


I will try to provide a complete answer.

All commands must be executed in the Terminal application.

  1. If you don't have it: Install Command Line Tools for Xcode

    xcode-select --install

  2. If you don't have it: Install HomeBrew

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  3. If you don't have it: Install Node.js

    brew install node

  4. Install LessCSS

    sudo npm install -g less

Now you can execute lessc commands.




回答3:


i`m using macOS Siera and work for me, you can try:

  1. install npm using brew:

    brew install node

  2. check node and npm version using:

    node -v npm -v

3.change user to SU using:

sudo su

  1. install less:

npm install -g less

Good Luck.....



来源:https://stackoverflow.com/questions/18928028/lesscss-command-line-compiler-lessc

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