2
  1. Install JSS:

npm install -g @sitecore-jss/sitecore-jss-cli

  1. create default react app - runs in Chrome:

jss create jss-react-app react

cd jss-react-app

jss start

  1. create default angular app and attempt to run:

jss create jss-angular-app angular

cd jss-angular-app

jss start

Expected: build and run, just like react app

Observed: cannot build due to build error.

chunk {main} main.js, main.js.map (main) 3.26 kB [entry] [rendered]

ERROR in node_modules/apollo-angular/types.d.ts(9,58): error TS2304: Cannot find name 'Exclude'. src/app/jss-graphql.service.ts(3,10): error TS2305: Module '"C:/Test/jss-angular-app/node_modules/apollo-angular/types"' has no exported member 'TypedVariables'.

Gotta be something stupid on my part, since I can't find anything on the web about this error. Thanks!

Windows 7, Chrome 70.0.3538.102 JSS: 9.0.6 Angular: 6.1.10 AngularCLI: 6.2.7 Node: 10.13.0

enter image description here

2 Answers 2

2

Pin your apollo-angular version to exactly 1.1.1 in the package.json (remove the ^), then run npm i again:

https://github.com/Sitecore/jss/blob/0292a05077c4ef21b668eb9c30412f57620c3779/samples/angular/package.json#L66

Unfortunately if packages are installed without a lock file (i.e. using npm since the sample ships with a yarn lockfile) to limit using newer versions the apollo-angular is installed with a version designed for a later version of Angular than the app has.

1

I figured out that TypedVariables last existed in apollo-angular in version 1.4, so I pinned that version. Then I got an error where Exclude wasn't defined, so I pinned typescript to 2.9.2. Therefore, after creating the default angular app and changing to that folder, run:

npm install [email protected] --save-exact

npm install [email protected] --save-exact

BEFORE trying to build and start the app and it will build and run just fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.