Unable to load plugin clean-css please make sure that it is installed under or at the same level as less

2.6k views Asked by At

I have a bash script that minifies all my less files and outputs the result into a .min.css file. I have already looked at other answers on similar questions, but nothing works. After updating to Mac OS Catalina today my bash script stopped working and is giving this error:

Unable to load plugin clean-css please make sure that it is installed under or at the same level as less

This is part of the contents of my minify bash script :

YOORS=$(pwd)
...
cd ${PROJECT}/less
...

printf "%-${WIDTH}s %10s\n" "Compiling lessfile content" $(~/node_modules/.bin/lessc --clean-css plugins/lessfile.less > ${PROJECT}/web/css/plugins/lessfile.min.css && echo "${GREEN}[OK]${NC}" || echo "${RED}[FAIL]${NC}")

It is weird, since firing the command in the command line works perfectly fine, but the bash script suddenly stopped working.

Clean-css is installed on my pc:

MacBook-Pro:yoors user$ cleancss -v
4.3.0
1

There are 1 answers

0
nilosch On BEST ANSWER

Had the same error, but in another environment. Installed the clean-css plugin for less, then it worked:

npm install -g less-plugin-clean-css