Nx: Error generating library, not other schematics

Created on 22 Aug 2018  路  12Comments  路  Source: nrwl/nx

OG Nx user here. Been through the upgrade path to jump from 1.x to 6.x.
When trying to generate a new lib I get a cryptic error. Generating components et al works fine.
ng g lib libname
'Cannot read property 'entries' of undefined'
Nx: 6.2.1
CLI: 6.1.2
Linux

repro needed bug

Most helpful comment

After updating everything my error has morphed to:
'Unexpected token } in JSON at position 1017'
Strange how lib is the only module type that won't build.

For this particular issue I found that I had invalid JSON for my tsconfig.app.json (e.g. trailing comma), so you could double check your particular *.json files as most get touched in schematics.

All 12 comments

What about apps? Do they create ok? I had the same issue until I noticed that my angular schematic packages were not uptodate. Bumping them up fixed the issue for me.

It might not be the same thing but in case it is any use this is what I'm running now.

```
Angular CLI: 6.1.4
Node: 10.8.0
OS: win32 x64
Angular: 6.1.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

Package Version

@angular-devkit/architect 0.7.4
@angular-devkit/build-angular 0.7.4
@angular-devkit/build-ng-packagr 0.7.4
@angular-devkit/build-optimizer 0.7.4
@angular-devkit/build-webpack 0.7.4
@angular-devkit/core 0.7.4
@angular-devkit/schematics 0.7.4
@angular/cdk 6.2.1
@angular/cli 6.1.4
@angular/flex-layout 6.0.0-beta.17
@angular/material 6.2.1
@angular/material-moment-adapter 6.2.1
@ngtools/json-schema 1.1.0
@ngtools/webpack 6.1.4
@schematics/angular 0.7.4
@schematics/update 0.7.4
ng-packagr 2.4.1
rxjs 6.2.2
typescript 2.9.2
webpack 4.9.2

After updating everything my error has morphed to:
'Unexpected token } in JSON at position 1017'
Strange how lib is the only module type that won't build.

Sorry.. I'm having trouble finding anywhere where an entries property might be accessed when generating a lib.. Can you please provide a minimal reproduction of this issue?

I am unable to repro on a fresh Nx workspace and app. Generating libs works fine for me there.
I'm not sure how I should go about locating where this error is coming from?
I tried to update all the angular schematics. That did not seem to help.

I have the same problem.
I use nx since the beginning.
Upgrading to version 6 was painful but worked (altough, I don't remenber if I added an app since the upgrade... libs, for sure).
I want to add an app but I have the mentionned error.
run ng update for all, but still got the error.
I can't generate nor app or lib :(

With a new workspace, it runs fine :(

@FrozenPandaz having the same issue. Currently on NX v6.1.1, when upgrading to 6.3.0, generating new apps doesn't work any more. I'll see whether I'm able to create a reproduction repository for you

As a work around do y'all think it makes sense to generate a fresh workspace and just bring over all my libs?

Thought I might update this thread with some debug. I would really love to generate libs again!

An error occured:
Cannot read property 'entries' of undefined
TypeError: Cannot read property 'entries' of undefined
    at new FilteredTree (/home/d/k7/node_modules/@angular-devkit/schematics/src/tree/filtered.js:13:18)
    at /home/d/k7/node_modules/@angular-devkit/schematics/src/rules/base.js:82:22
    at MergeMapSubscriber.input.pipe.operators_1.mergeMap.inputTree [as project] (/home/d/k7/node_modules/@angular-devkit/schematics/src/rules/call.js:77:24)
    at MergeMapSubscriber._tryNext (/home/d/k7/node_modules/rxjs/internal/operators/mergeMap.js:69:27)
    at MergeMapSubscriber._next (/home/d/k7/node_modules/rxjs/internal/operators/mergeMap.js:59:18)
    at MergeMapSubscriber.Subscriber.next (/home/d/k7/node_modules/rxjs/internal/Subscriber.js:67:18)
    at MergeMapSubscriber.notifyNext (/home/d/k7/node_modules/rxjs/internal/operators/mergeMap.js:92:26)
    at InnerSubscriber._next (/home/d/k7/node_modules/rxjs/internal/InnerSubscriber.js:28:21)
    at InnerSubscriber.Subscriber.next (/home/d/k7/node_modules/rxjs/internal/Subscriber.js:67:18)
    at TapSubscriber._next (/home/d/k7/node_modules/rxjs/internal/operators/tap.js:65:26)

After updating everything my error has morphed to:
'Unexpected token } in JSON at position 1017'
Strange how lib is the only module type that won't build.

For this particular issue I found that I had invalid JSON for my tsconfig.app.json (e.g. trailing comma), so you could double check your particular *.json files as most get touched in schematics.

I can now generate libs again!
Fixed in version 7.1.1

Oh man, I had the same problem. Also trailing comma... I would be nice if there was a more explicit error, since I only got Unexpected token } in JSON at position 704 :/

For me was a trailing comma in tsconfig.json . Once removed the command ran properly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Koslun picture Koslun  路  3Comments

ZempTime picture ZempTime  路  3Comments

joelmuskwe picture joelmuskwe  路  3Comments

elliotmendiola picture elliotmendiola  路  3Comments

SWGeekPD picture SWGeekPD  路  3Comments