LESS version mismatch
See original GitHub issueType of Issue
[x] Bug Report
[ ] Feature Request
Description
While converting an Angular 6 library to use ng-packagr
, I received this error message:
Unable to interpret argument less-plugin-npm-import - if it is a plugin (less-plugin-less-plugin-npm-import), make sure that it is installed under or at the same level as less
The issue seems to be that ng-packagr
requires less@^3.8.0
, and my project was already using less@2.3.1
. For processing LESS files, the stylesheet-processor.ts uses a direct path into node_modules/less/bin/lessc
, which pointed to my project’s local less@2.3.1
package, not the expected less@^3.8.0
. Since these two versions have slightly different methods for specifying plugins in CLI arguments, the process failed.
This bug could be avoided by including the expected version of less
(currently less@^3.8.0
) as a peer dependency.
Related: PR #1060
How To Reproduce
- Create an angular project using the
ng new
command - Install a local dependency on
less@2.3.1
- Generate a library with
ng g library testlib
- Add a LESS stylesheet to the library
- Try to build the
testlib
library withng build testlib
Expected Behaviour
The ng-packagr
package should specify that it expects less@^3.8.0
to be installed as a peer dependency.
Version Information
$ node_modules/.bin/ng-packagr --version
ng-packagr: 4.7.1
@angular/compiler: 6.1.10
rollup: 0.67.4
tsickle: 0.32.1
typescript: 2.9.2
$ npm ls less
+-- @angular-devkit/build-angular@0.6.8
| `-- less@3.9.0
+-- less@2.3.1
`-- ng-packagr@4.7.1
`-- less@3.9.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
@alan-agius4 I was just going to type that… 😛
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem. This action has been performed automatically by a bot.