20

I am having some troubles after executing my angular application with npm start, 'ChainExpression' & 'ImportExpression'members of ESTree interface are not exported causing errors...

Please check image below:

enter image description here

I am using Angular 12 and next node dependencies in my package.json, please see below:

{
...
"@types/node": "12.11.1",
"eslint": "7.10.0",
"ts-node": "8.3.0",
"tslib": "2.2.0",
"tslint": "6.1.0",
"typescript": "4.2.4",
...
}

Do you have any idea about this problem? I will appreciate any kind of help.

1
  • Did you manage to solve this?
    – Ivan Lesar
    Jul 28, 2021 at 0:57

7 Answers 7

25

I had the same problem and could see there was a problem with my node modules @types: eslint was referring to ChainExpression and ImportExpression which were missing from estree. compared these with a new angular12 project and then fixed by updating my estree like so:

npm install @types/[email protected] 
5
  • 2
    Thanx! This helped me (with latest version though (0.0.50))
    – Aviw
    Sep 5, 2021 at 22:51
  • 1
    I was having a similar issue where a depenency of ng-packagr was using @types/[email protected] and for whatever reason, this causing issues when trying to use ng serve
    – Shane
    Dec 18, 2021 at 17:20
  • Also had the same issue using ng-packagr. This fixed it. Thanks! Mar 9, 2022 at 0:02
  • 1
    Also had the same issue using @storybook/addon-docs. Thanks!
    – samnau
    Jun 15, 2022 at 20:13
  • Thanx! helped to fix same problem in nestjs project. Fixed. Jul 3, 2022 at 7:49
9

I had the same problem running typedoc.

This fixed it.

npm install @types/estree@latest
7

I had the same problem. led me to adding "typeRoots": ["node_modules/@types"] to tsconfig.json which solved it.

$ node -v
v16.13.0

$ npm -v
8.5.1

$ yarn -v
1.22.5
4
  • Thanx! helped to fix same problem Jul 10, 2022 at 19:14
  • the default seems better in my case, typescriptlang.org/tsconfig#typeRoots I had the below problem, NX used @types/[email protected]
    – exrhizo
    Aug 3, 2022 at 2:18
  • The only thing that worked for me. (Node v12.22.0)
    – Liran H
    Aug 30, 2022 at 10:39
  • Thanks, this has solved my issue and should be marked as answer instead of adding a new dependency in the project.
    – Himanshu
    Nov 11, 2022 at 5:51
1

Try updating eslint to version 7.27.0, delete package-lock.json, delete node_modules folder and then npm install again.

It seems @types/estree updated 14 hours ago looking here and this could be causing issues.

By the way, if you are using eslint for linting, you can get rid of tslint entry in package.json.

1
  • Ok, try creating a new Angular 12 project and try to copy its dependencies as much as possible.
    – AliF50
    Jun 3, 2021 at 13:32
1

I am working on angular migration. I'm migrated my project from angular 11 to angular 12. while building the project I started getting following error

StaticBlock?: ((node: ESTree.StaticBlock & NodeParentExtension) => void) | undefined;

As suggested above I downgraded to @types/[email protected]. I started getting more errors.

PropertyDefinition?: ((node: ESTree.PropertyDefinition & NodeParentExtension) => void) | undefined;

PrivateIdentifier?: ((node: ESTree.PrivateIdentifier & NodeParentExtension) => void) | undefined;

 StaticBlock?: ((node: ESTree.StaticBlock & NodeParentExtension) => void) | undefined;

I digged into definition file realized these properties were not available in @types/estree definition file.

I upgraded estree from 0.0.47 to 1.0.0. This resolved build error.

npm i -D @types/[email protected]
0

Somehow @types/eslint is behind. Solution to this problem is:

npm install --save-dev @types/eslint

Then remove package-lock.json and node_modules folder and run install again:

npm install

Errors should be gone now.

0

I solved that problem by upgrading angular-eslint-schematics to compatible version for Angular 12 which is "@angular-eslint/schematics": "12.7.0".

I want to write it down here since it does not requires adding new library to project.

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.