问题
I'm on OS X.8 and a newbie at Node & LESS. I thought I installed lessc earlier and when I go to /usr/local/bin I see lessc
but for the life of me, I can't run it. Anytime I do run it, I see -bash: lessc: command not found
So I've tried the tip here which has the following:
ln -s ~/.npm/less/1.3.3/package/bin/lessc my/local/dir
My local dir happens to be on a second drive on my laptop, here's the path: /Volumes/Mac17/Users/denis2/Sites/staging/assets/less
With all that said, I try and run:
lessc boostrap.less
and still get
-bash: lessc: command not found
I'm totally lost here and any help would be tremendous.
回答1:
Just follow the steps :
- Make lessc executable by your user(permission denied means you dont have permission to run) like
chmod 755 lessc
- Export the location of lessc into the PATH like
export PATH=$PATH:/home/user/folder/path/less/bin
(where lessc is present) - Use lessc
lessc boostrap.less
You should put PATH export in environment so that you dont have to do it every time you login See here : Setting environment variables in OS X?
回答2:
If you enter just lessc
, it is searched in the $PATH
. For security reasons, the current directory is not in the $PATH
. Try
./lessc bootstrap.less
or, if that doesn't work, simply
~/.npm/less/1.3.3/package/bin/lessc bootstrap.less
If you get a Permission Denied
error then, you may need to mark the file as executable. Use
chmod a+x ~/.npm/less/1.3.3/package/bin/lessc
to do that. You may also need to call node directly, if it isn't in your $PATH
.
来源:https://stackoverflow.com/questions/14843266/lessc-command-not-found