当我尝试在Ubuntu 13.10框下安装较少的CSS编译器时,出现以下消息,而lescss无法正常工作。我可以用什么方式解决问题?我执行:

sudo npm install -g less


之后,我会收到带有OK消息的e列表:

npm http 304 https://registry.npmjs.org/cryptiles
npm http 304 https://registry.npmjs.org/ctype/0.5.2
npm http 304 https://registry.npmjs.org/combined-stream
npm http GET https://registry.npmjs.org/delayed-stream/0.0.5
npm http 304 https://registry.npmjs.org/sntp
npm http 304 https://registry.npmjs.org/boom
npm http 304 https://registry.npmjs.org/delayed-stream/0.0.5


并列出以下内容:

 /usr/local/bin/lessc -> /usr/local/lib/node_modules/less/bin/lessc
    [email protected] /usr/local/lib/node_modules/less
    ├── [email protected]
    ├── [email protected]
    ├── [email protected] ([email protected])
    ├── [email protected] ([email protected])
    └── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])


之后,当我尝试以下命令时:

echo "@foo: 25px; #foobar{font-size: @foo};" > style.less
sudo lessc ./style.less ./style.css


我收到以下错误:

/usr/bin/env: node: No such file or directory


我执行后

ln -s /usr/bin/node /usr/local/bin/nodejs


并创建了符号链接,没有错误,但是lessc编译器无法正常工作。
我已经创建了要测试的文件。它的内容是:

猫式

@color: #4D926F;

#header {
  color: @color;
}
h2 {
  color: @color;
}`


并尝试后

lessc styles.less > styles.css


已创建文件-styles.css,但该文件为空。
我还尝试了以前尝试过的命令-请参阅文章顶部。

lessc styles.less styles.css


但它不起作用。结果没有文件。
当我尝试

sudo npm install -g less


在最后一行中,我收到以下错误。

npm http 200 https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz
/usr/bin/lessc -> /usr/lib/node_modules/less/bin/lessc
npm ERR! Refusing to delete: /usr/bin/lessc not in /usr/lib/node_modules/less
File exists: /usr/bin/lessc
Move it away, and try again.

npm ERR! System Linux 3.11.0-19-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "less"
npm ERR! cwd /home/georgi
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path /usr/bin/lessc
npm ERR! code EEXIST
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/georgi/npm-debug.log
npm ERR! not ok code 0

最佳答案

>命令运算符在您的命令中不正确。正确的命令是:

lessc [sourcefile] [destfile]


对于您的示例,您的命令是:

lessc styles.less styles.css

09-25 18:52