通过 NPM 安装 less 后,lessc 二进制文件不可用
我继续安装并测试了node.js,然后通过NPM安装了LESS CSS,但是当我输入命令
lessc styles.less
或
lessc styles.less > styles.css
它告诉我-bash:lessc:命令未找到
我在MAC Lion中终端程序
编辑:
安装 Node 后,您需要运行此命令
ln -s ~/.npm/less/1.2.1/package/bin/lessc (path to directory you want)
然后您将能够在该目录中的任何 less 文件上运行 less。
它可以工作,但它不会将导入编译到一个 CSS 文件中。它只是将导入保留在文件中。我希望能够将导入的文件中的所有 CSS 组合在一起。
I went ahead and installed and tested node.js and then I installed LESS CSS via NPM but when I type in the command
lessc styles.less
or
lessc styles.less > styles.css
It tells me -bash: lessc: command not found
I'm in MAC Lion Terminal program
EDIT:
After installing Node you need to run this command
ln -s ~/.npm/less/1.2.1/package/bin/lessc (path to directory you want)
Then you will be able to run less on any of the less files in that directory.
It works but it's not compiling the imports into one CSS file. It just leaves the imports in the file as is. I was hoping I could combine all of the CSS inside the files that I'm importing together.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您通过 npm 安装 LESS 时,请使用 -g 选项进行全局安装。
npm install -g less
When you install LESS via npm use the -g option to install it globally.
npm install -g less
使用
npm
安装软件包时,您有两种选择:npm install -g
~/.npm 下的主目录中本地安装
:npm install
如果您选择选项 1,您的系统应该能够找到二进制文件
lessc
。如果您选择选项 2,您应该将~/.npm/less/path_to_bin_directory
添加到您的路径:或者更好,如果由于以下原因创建了
~/node_modules
目录安装:When installing packages with
npm
you have two options:npm install -g <package>
~/.npm
:npm install <package>
If you choose option 1 your system should be able to locate the binary
lessc
. If you choose option 2 you should add~/.npm/less/path_to_bin_directory
to your path:or better, if a
~/node_modules
directory has been created as a result of installation: