Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lessc can't find plugins when not in cwd(?) #3181

Closed
Franziskus1988 opened this issue Feb 27, 2018 · 12 comments
Closed

lessc can't find plugins when not in cwd(?) #3181

Franziskus1988 opened this issue Feb 27, 2018 · 12 comments

Comments

@Franziskus1988
Copy link

I have encountered a weird behaviour. When I use the less command line tool with a path it doesn't detect that the css-clean plugin is installed. Whereas when I use it in the folder where the node_modules are placed it works. See image:

grafik

@seven-phases-max
Copy link
Member

Does this happen only with the clean-css plugin or ...?

@seven-phases-max seven-phases-max changed the title Problems using the command-line tool with path lessc can't find plugins when not in cwd(?) Feb 27, 2018
@Franziskus1988
Copy link
Author

Franziskus1988 commented Feb 28, 2018

grafik

@seven-phases-max Seems to be plugin independant.

@mikekasprzak
Copy link

I just started getting the above autoprefix error myself. I haven't touched my code in weeks.

@twiginteractive
Copy link

Bug was introduced in v3.x, so I had to downgrade to less 2.7.3

@mikekasprzak
Copy link

I just made the same discovery and fix. I didn't notice 3.x was out due to how the Releases page looked.

screenshot from 2018-03-06 13-59-28

@WraithKenny
Copy link

@seven-phases-max it seems to be all plugins

@luccasfraga
Copy link

I was in version 3.0.1 and it is not working. Just do this to solve.
See your lessc version:

lessc -v

after that enter:

npm install less@2.7.1 -g

coakenfold added a commit to coakenfold/TimelineJS3 that referenced this issue Apr 9, 2018
`Unable to load plugin clean-css please make sure that it is installed under or at the same level as less
Fatal error: Error running lessc on ...`

Downgraded Less:
    less/less-plugin-clean-css#23
    less/less.js#3181
@Franziskus1988
Copy link
Author

@seven-phases-max Any plan to fix this?

@matthew-dean
Copy link
Member

@Franziskus1988 If you or anyone else would like to submit a PR for this, that would be welcome.

@Franziskus1988
Copy link
Author

Franziskus1988 commented Apr 12, 2018

@matthew-dean I've tried to fix it. Unfortunatelly the "failing import" test is failing. I don't know if there is a more convenient way to find the root folder of the node_modules installation. The test is now failing because I'm using a path which is relative to the less-node/index.js script position. In a node installation it works, but in the test enviroment it resolves to the wrong location. I could do an ugly fix for the test, but I actually don't know how to fix it nicely.

@Franziskus1988
Copy link
Author

I think the problem is that process.cwd()/node_modules is added as path, although it should point to the node_modules folder of the less installation. Since process.cwd() always resolves to the current location in terminal the plugins, which are installed in the same package as less aren't found.

matthew-dean pushed a commit to matthew-dean/less.js that referenced this issue Apr 18, 2018
@matthew-dean
Copy link
Member

@Franziskus1988 Please see #3200.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants