question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Packaging library with component with external less stylesheet from working directory with spaces

See original GitHub issue

Type 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

  1. Create a working directory with spaces in it, i.e. C:\My Path\With Spaces\my-project.
  2. Create an angular library project.
  3. Create a component in library project which references an external less style file.
  4. 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:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
alan-agius4commented, Jan 26, 2019

The fix is available in version 4.7.0

1reaction
daryl0313commented, Jan 26, 2019

Wow thanks for getting this fixed so quickly! I was planning on trying to put together a pr for this over the weekend.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found