Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Angular InstantSearch failing to compile when using node version 14 #967

Closed
SheLovesCode opened this issue Oct 3, 2022 · 5 comments · Fixed by #968
Closed

Angular InstantSearch failing to compile when using node version 14 #967

SheLovesCode opened this issue Oct 3, 2022 · 5 comments · Fixed by #968

Comments

@SheLovesCode
Copy link

SheLovesCode commented Oct 3, 2022

Describe the bug 🐛

We are currently trying to run Angular InstantSearch using one of your code samples repository Doc Code Samples and the project is failing to comple after running npm install . using node 14. The project runs perfectly when node 16 is used.

To Reproduce 🔍

Steps to reproduce the behavior:

1. git clone https://github.com/algolia/doc-code-samples/
2. nvm use 14.16.1
3. node -v 
  This should show that node 14.16.1 is in use
5. cd doc-code-samples/angular-instantsearch/getting-started
6. npm install . && npm run start

Expected behavior 💭

The build fails to compile, throwing the following errors:


Error: node_modules/@algolia/ui-components-highlight-vdom/dist/esm/Highlight.d.ts:1:23 - error TS2688: Cannot find type definition file for 'react'.

1 ///
~~~~~

Error: node_modules/@algolia/ui-components-highlight-vdom/dist/esm/Highlight.d.ts:33:209 - error TS2503: Cannot find namespace 'JSX'.

33 export declare function createHighlightComponent({ createElement, Fragment, }: Renderer): ({ parts, highlightedTagName, nonHighlightedTagName, separator, className, classNames, ...props }: HighlightProps) => JSX.Element;
~~~


Screenshots 🖥

The complete error log can be seen below:

Screenshot from 2022-10-03 15-17-56

Environment:

  • OS: Ubuntu 20.04.1 LTS
  • Node Version: 14.16.1
  • Angular Version: 12.2.1
  • Algolia search version: 4.14.2
  • Algolia instant search version: 4.3.0
@Emily-RoseSteyn
Copy link
Contributor

Emily-RoseSteyn commented Oct 4, 2022

I managed to also reproduce this by running npx create-instantsearch-app my-app --template "Angular InstantSearch". I was still getting this issue in Node 16 when using the template. I was trying various solutions and the only thing that seemed to solve the issue is when I installed @types/react to my dev dependencies. This seems a bit weird considering it is an Angular app and this doesn't seem to be required based on the docs.

@Haroenv
Copy link
Contributor

Haroenv commented Oct 4, 2022

Do you also have this if you have the latest version of InstantSearch.js (underlying)? The fix should have been released in 4.46.2 algolia/instantsearch#5109 (comment)

@Emily-RoseSteyn
Copy link
Contributor

I think that the issue is because instantsearch is still at ^4.45.0 in the angular-instantsearch dependencies. I've made a PR for the update in #968 although I am not sure I've followed the right process for that. Hope that helps!

@Haroenv
Copy link
Contributor

Haroenv commented Oct 6, 2022

Thanks for that PR, it indeed will cause people to have minimally have this issue @Emily-RoseSteyn

Haroenv added a commit to algolia/ui-components that referenced this issue Oct 10, 2022
* fix(shared): make usable when there's no preact or react

see algolia/angular-instantsearch#968, algolia/angular-instantsearch#967 and  algolia/instantsearch#5109

* Update packages/shared/src/Renderer.ts

Co-authored-by: Sarah Dayan <[email protected]>

* avoid usage of JSX.IntrinsicElements, as it can fall back to empty interface

eg. in the case there's no JSX set (angular, vue)

* add a bit more text

Co-authored-by: Sarah Dayan <[email protected]>
@Haroenv
Copy link
Contributor

Haroenv commented Oct 18, 2022

Sorry for the delay here, this involved a lot of moving pieces. To ensure it's definitely updated, we've released 4.3.1 of Angular InstantSearch that fixes the issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants