当我尝试在我的Ubuntu 13.10框下安装较少的css编译器时,我得到以下消息并且lescss不起作用。我以什么方式解决问题?我执行:
sudo npm install -g less
在此之后,我会收到包含确定消息的电子邮件列表:
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
less@1.7.0 /usr/local/lib/node_modules/less
├── mime@1.2.11
├── mkdirp@0.3.5
├── source-map@0.1.33 (amdefine@0.1.0)
├── clean-css@2.1.8 (commander@2.1.0)
└── request@2.34.0 (json-stringify-safe@5.0.0, forever-agent@0.5.2, aws-sign2@0.5.0, qs@0.6.6, tunnel-agent@0.3.0, oauth-sign@0.3.0, node-uuid@1.4.1, tough-cookie@0.12.1, http-signature@0.10.0, hawk@1.0.0, form-data@0.1.2)
此后我尝试了以下命令:
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编译器无法正常工作。 我已经创建了要测试的文件。它的内容是:
cat style.less
@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
答案 0 :(得分:1)
命令中的>
命令运算符不正确。正确的命令是:
lessc [sourcefile] [destfile]
对于您的示例,您的命令是:
lessc styles.less styles.css