Packaging library with component with external less stylesheet from working directory with spaces
See original GitHub issueType of Issue
[X] Bug Report
[ ] Feature Request
Description
I am getting the issue below when trying to compile am angular library which has a component and uses an external less
file for styles. I think this may be windows specific and appears to be caused by the fact that my working directory has a space in the path, i.e. C:\My Path\With Spaces\my-project
.
Building Angular Package
Building entry point 'mylibrary'
Compiling TypeScript sources through ngc
lessc: ENOENT: no such file or directory, open 'C:\My'
BUILD ERROR
: Error: Command failed: node node_modules/less/bin/lessc C:\My Path\With Spaces\my-project\libraries\mylibrary\src\lib\my-component\my-component.component.less --less-plugin-npm-import="prefix=~"
lessc: ENOENT: no such file or directory, open 'C:\My'
at checkExecSyncError (child_process.js:601:13)
at Object.execSync (child_process.js:641:13)
at StylesheetProcessor.renderPreProcessor (C:\My Path\With Spaces\my-project\node_modules\ng-packagr\lib\ng-v5\entry-point\resources\stylesheet-processor.js:56:40)
at StylesheetProcessor.process (C:\My Path\With Spaces\my-project\node_modules\ng-packagr\lib\ng-v5\entry-point\resources\stylesheet-processor.js:25:34)
at Object.readResource (C:\My Path\With Spaces\my-project\node_modules\ng-packagr\lib\ts\cache-compiler-host.js:68:57)
at TsCompilerAotCompilerTypeCheckHostAdapter.loadResource (C:\My Path\With Spaces\my-project\node_modules\@angular\compiler-cli\src\transformers\compiler_host.js:477:37)
at Object.get (C:\My Path\With Spaces\my-project\node_modules\@angular\compiler\bundles\compiler.umd.js:23177:94)
at DirectiveNormalizer._fetch (C:\My Path\With Spaces\my-project\node_modules\@angular\compiler\bundles\compiler.umd.js:2465:47)
at C:\My Path\With Spaces\my-project\node_modules\@angular\compiler\bundles\compiler.umd.js:2586:72
at Array.map (<anonymous>)
How To Reproduce
- Create a working directory with spaces in it, i.e.
C:\My Path\With Spaces\my-project
. - Create an angular library project.
- Create a component in library project which references an external
less
style file. - Run
ng build
to build library.
Expected Behaviour
Should build library with no exceptions.
Version Information
$ node_modules/.bin/ng-packagr --version
ng-packagr: 4.4.5
@angular/*: 6.1.10
typescript: 2.8.3
rxjs: 6.3.3
node: 8.11.1
npm: 5.8.0
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Explicit understanding of python package building (structuring)
In python import, a code written in an external file causes to name that imported file as “module” in the current namespace.
Read more >import - CSS: Cascading Style Sheets - MDN Web Docs
The @import CSS at-rule is used to import style rules from other valid stylesheets. An @import rule must be defined at the top...
Read more >Angular - Shortcut to Importing Styles Files in Components
Angular - Shortcut to Import Styles Files in Component. ... Each components has it own stylesheet (css, scss, less, etc).
Read more >Using with Preprocessors - Tailwind CSS
A guide to using Tailwind with common CSS preprocessors like Sass, Less, and Stylus.
Read more >How to import CSS from node_modules in webpack angular2 ...
"Copy the external css module to the assets folder, and use it from there". I'm looking for a solution that works together with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The fix is available in version 4.7.0
Wow thanks for getting this fixed so quickly! I was planning on trying to put together a pr for this over the weekend.