Manuel
Manuel

Reputation: 53

New buildable angular library can not be build

so... I have the latest version of nx (11.1.5) running in a new workspace (--preset empty) running and I want to add a new buildable angular library.

nx g @nrwl/angular:library --buildable --style scss --name my-lib

The library is created and seems to be alright. Next, I want to build that library without changing something on the code using:

nx build my-lib

My expectation is, that this runs through without any problems. Doesn't make sense to build an empty module, but should work, right?

But the build exits with the following error message:

No provider for InjectionToken ng.v5.stylesheetProcessor! (InjectionToken nx.v1.packageTransform -> InjectionToken nx.v1.entryPointTransform -> InjectionToken ng.v5.compileNgcTransform -> InjectionToken ng.v5.stylesheetProcessor)

Even when I add components and export them or import the module in an app, the error shows up.

What am I missing here? Is this a bug?

It's also reproducible in the example repo: https://github.com/nrwl/nx-examples

Greetings

Upvotes: 4

Views: 3259

Answers (2)

Stephen
Stephen

Reputation: 1701

Suggestion: re-build package-lock.json

I was getting this same error but when chasing the commit that caused it using git bisect, the commit didn't have any scss changes at all. It had some unexpected package-lock.json changes, so I reverted that file with git checkout <before broken> .\package-lock.json followed by npm install, and npx ng run build, it succeeded. My new package-lock.json had a lot of new changes, that were not in the broken one, and these changes didn't get included with a npm install without reverts to that package-lock.json. These new changes included a downgrade of sass, as a dependency of ng-package, from ^1.32.5 to ^1.26.0. ng-package itself got downgraded from 11.1.2 to 11.0.3

Upvotes: 0

Lars
Lars

Reputation: 6539

It seems there is a fix on the way...

https://github.com/nrwl/nx/pull/4578

Upvotes: 2

Related Questions