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

Scss build fails because of shim.ngstyle.js not found #15453

Closed
Kaspazza opened this issue Aug 27, 2019 · 19 comments
Closed

Scss build fails because of shim.ngstyle.js not found #15453

Kaspazza opened this issue Aug 27, 2019 · 19 comments

Comments

@Kaspazza
Copy link

Kaspazza commented Aug 27, 2019

🐞 Bug report

Command (mark with an x)

- [ ] new
- [ x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

This bug was not present in previous versions.

Description

Sometimes (I can't say what triggers it but for sure when there were changes in scss file) while building a project (with --aot flag, I didn't have checked either the bug occurs without it) (scss file).shim.ngstyle.js is not to be found and after serving again no errors occur.

A clear and concise description of the problem...

🔬 Minimal Reproduction

1.make changes in scss file
2. ng s --aot
On some repetition, it will happen.

🔥 Exception or Error




ERROR in ./src/app/modules/patients/components/patient-details/patient-evaluation/goals/goals-content/goals-content.component.scss.shim.ngstyle.js
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: ENOENT: no such file or directory, open 'C:\Users\user\Desktop\projekt\portal\src\app\modules\patients\components\patient-details\patient-evaluation\goals\goals-content\goals-content.component.scss.shim.ngstyle.js'
    at Object.openSync (fs.js:438:3)
    at Object.readFileSync (fs.js:343:35)
    at Storage.provideSync (C:\Users\user\Desktop\projekt\portal\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:98:13)
    at CachedInputFileSystem.readFileSync (C:\Users\user\Desktop\projekt\portal\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:259:32)
    at Observable.rxjs_1.Observable.obs [as _subscribe] (C:\Users\user\Desktop\projekt\portal\node_modules\@ngtools\webpack\src\webpack-input-host.js:35:51)
    at Observable._trySubscribe (C:\Users\user\Desktop\projekt\portal\node_modules\@ngtools\webpack\node_modules\rxjs\internal\Observable.js:44:25)
    at Observable.subscribe (C:\Users\user\Desktop\projekt\portal\node_modules\@ngtools\webpack\node_modules\rxjs\internal\Observable.js:30:22)
    at SyncDelegateHost._doSyncCall (C:\Users\user\Desktop\projekt\portal\node_modules\@angular-devkit\core\src\virtual-fs\host\sync.js:22:20)
    at SyncDelegateHost.read (C:\Users\user\Desktop\projekt\portal\node_modules\@angular-devkit\core\src\virtual-fs\host\sync.js:49:21)
    at WebpackCompilerHost.readFileBuffer (C:\Users\user\Desktop\projekt\portal\node_modules\@ngtools\webpack\src\compiler_host.js:147:44)
    at VirtualFileSystemDecorator.readFile (C:\Users\user\Desktop\projekt\portal\node_modules\@ngtools\webpack\src\virtual_file_system_decorator.js:42:54)
    at processResource (C:\Users\user\Desktop\projekt\portal\node_modules\loader-runner\lib\LoaderRunner.js:202:11)
    at iteratePitchingLoaders (C:\Users\user\Desktop\projekt\portal\node_modules\loader-runner\lib\LoaderRunner.js:158:10)
    at iteratePitchingLoaders (C:\Users\user\Desktop\projekt\portal\node_modules\loader-runner\lib\LoaderRunner.js:165:10)
    at C:\Users\user\Desktop\projekt\portal\node_modules\loader-runner\lib\LoaderRunner.js:176:18
    at loadLoader (C:\Users\user\Desktop\projekt\portal\node_modules\loader-runner\lib\loadLoader.js:47:3)
i 「wdm」: Failed to compile.

🌍 Your Environment




Angular CLI: 8.3.0
Node: 10.15.3
OS: win32 x64
Angular: 8.2.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.802.2
@angular-devkit/build-angular     0.802.2
@angular-devkit/build-optimizer   0.802.2
@angular-devkit/build-webpack     0.802.2
@angular-devkit/core              8.2.2
@angular-devkit/schematics        8.3.0
@angular/cli                      8.3.0
@ngtools/webpack                  8.2.2
@schematics/angular               8.3.0
@schematics/update                0.803.0
rxjs                              6.5.2
typescript                        3.4.5
webpack                           4.39.2

Anything else relevant?

@nullr00tbyte
Copy link

nullr00tbyte commented Aug 27, 2019

i had the same problem, i just only change one line in component.csss

Angular CLI: 8.2.2
Node: 11.15.0
OS: linux x64
Angular: 8.2.2

Package Version

@angular-devkit/architect 0.802.2
@angular-devkit/build-angular 0.802.2
@angular-devkit/build-optimizer 0.802.2
@angular-devkit/build-webpack 0.802.2
@angular-devkit/core 8.2.2
@angular-devkit/schematics 8.2.2
@angular/http 7.2.15
@ngtools/webpack 8.2.2
@schematics/angular 8.2.2
@schematics/update 0.802.2
rxjs 6.4.0
typescript 3.5.3
webpack 4.38.0
`

@nullr00tbyte
Copy link

I Found a solution

in cmd.exe

echo > C:\Users\user\Desktop\projekt\portal\src\app\modules\patients\components\patient-details\patient-evaluation\goals\goals-content\goals-content.component.scss.shim.ngstyle.js

create the file and rebuild

@Kaspazza
Copy link
Author

It's not a good solution as it happens randomly to any edited scss file. Also, the problem is not that it's impossible to build, as it occurs only once in a while and usually after one rebuild it works fine. Your fix (even if It would work) is more of a hack than an actual solution to the problem.

@nullr00tbyte
Copy link

It's not a good solution as it happens randomly to any edited scss file. Also, the problem is not that it's impossible to build, as it occurs only once in a while and usually after one rebuild it works fine. Your fix (even if It would work) is more of a hack than an actual solution to the problem.

yo're right, iknow that is not a solution of the real problem, but work if u dont have time to the patch

@alan-agius4 alan-agius4 added area: @ngtools/webpack freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix labels Aug 28, 2019
@ngbot ngbot bot modified the milestone: Backlog Aug 28, 2019
@alan-agius4
Copy link
Collaborator

This seems to be related to a race condition when saving re-saving a file while a compilation has not yet finished.

@alan-agius4 alan-agius4 removed the freq1: low Only reported by a handful of users who observe it rarely label Aug 28, 2019
@ngbot ngbot bot modified the milestones: Backlog, needsTriage Aug 28, 2019
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Aug 28, 2019
@Adelaiten
Copy link

I Found a solution

in cmd.exe

echo > C:\Users\user\Desktop\projekt\portal\src\app\modules\patients\components\patient-details\patient-evaluation\goals\goals-content\goals-content.component.scss.shim.ngstyle.js

create the file and rebuild

It will help for a while but I think this is result of running ng serve again not from deleting and recreating it.

@nullr00tbyte
Copy link

nullr00tbyte commented Aug 29, 2019

I Found a solution
in cmd.exe
echo > C:\Users\user\Desktop\projekt\portal\src\app\modules\patients\components\patient-details\patient-evaluation\goals\goals-content\goals-content.component.scss.shim.ngstyle.js
create the file and rebuild

It will help for a while but I think this is result of running ng serve again not from deleting and recreating it.

yes!, yesterday i just run ng serve and it work, but in some times the file scss.shim.ngstyle.js is not only not found in that component but rather in any scss file that i made a change.

@GitStorageOne
Copy link

Same issue with 8.3.1

@TakeshiDaveau
Copy link

Same issue with 8.3.4

@rvalimaki
Copy link

This is not related to only SCSS build, but happens with LESS build as well (only difference being that it complaints about missing xxx.less.shim.ngstyle.js -files, and not xxx.scss.shim.ngstyle.js. Also you don't really need to do any LESS changes to get this error, but any change to any TS or HTML template file might randomly initiate that problem.

In our team, I am the only one that gets this error regularly, but most of us have seen this occasionally. I have to restart "ng serve --aot" multiple times a day, which is really irritating.

(angular-cli 8.3.4)

@mainginski
Copy link

Same issue with 8.2.0

@phantomk
Copy link

Same issue with 8.2.5

@Y2zz
Copy link

Y2zz commented Sep 21, 2019

I have often encountered this annoying problem since 8.0.

@sanket-work
Copy link

This seems to be related to a race condition when saving re-saving a file while a compilation has not yet finished.

This seems to be only acceptable reason for this issue.
I am facing the same, while using the ng serve with --aot

@noe132
Copy link

noe132 commented Sep 26, 2019

after sass file build fail, any file save or change won't trigger another incremental rebuild until restart build service

@rvalimaki
Copy link

This is happening several times a day for me (using mostly LESS, not SCSS), and it definitely sucks a lot to have to restart ng serve --aot all the time again, esp. when it takes more than 1 minute to complete for our rather large project.

@filipesilva
Copy link
Contributor

filipesilva commented Sep 27, 2019

I was able to reproduce this by following these steps:

npm install -g @angular/[email protected]
ng new scss-app --style=scss
cd scss-app
# add `"enableIvy": false,` inside `angularCompilerOptions` in `tsconfig.json`
ng serve --aot
# open `src/app/app.component.scss`, paste and save `h1 {color: black} ` dozens of times at difference paces

Trying to figure out what's happening.

filipesilva added a commit to filipesilva/angular-cli that referenced this issue Sep 27, 2019
@filipesilva
Copy link
Contributor

#15702 should fix it, hopefully out in the next patch version.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 28, 2019
ikjelle pushed a commit to ikjelle/angular-cli that referenced this issue Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests