javascripttypescriptionic-frameworkstenciljs

Stenciljs throwing build error from @types/babel__traverse package after fresh install


So for context, I have just installed stencil. And was wanting to mess around with it. I'm using latest version from the docs "npm install -g @stencil/core@latest --save-exact" and when I ran it the first time with npm start, It threw a bunch of errors and complained about missing library. So I ran npm install it fixed all those errors but now it throws a new error, when I try to run it. Keep in mind I have not edited or added any of my own code to the project. Error below. enter image description here Ignore the border thats my screenshot tool)

[ ERROR ] TypeScript: ./node_modules/@types/babel__traverse/index.d.ts:321:6 An index signature parameter type must be either 'string' or 'number'.

L320:      // this is good enough for non-visitor traverse options e.g. `noScope`
L321:      [k: `${string}|${string}`]: VisitNode<S, Node>;
L322:  };

[01:19.3] build failed, watching for changes... in 2.96 s`


Solution

  • This is a known issue with @types/babel__traverse v7.21.0 and later. We worked around the issue by installing v7.20.0.

    npm install --save-dev @types/babel__traverse@7.20.0
    

    and then modifying the package.json to remove the ^:

    "@types/babel__traverse": "7.20.0"