Closed OutdatedGuy closed 2 months ago
Hey @OutdatedGuy thanks for trying out the v5 client
I've not been able to reproduce the error, it compiles correctly on my side.
However from the error you shared, it seems like the peer dependencies of algoliasearch
are not installed. If they do not resolve automatically for you, it might be an exports
issue on our side.
Was it working with v4? You can also try to install them manually (@algolia/client-personalization
and so on), or use the umd
bundled file which contains them, usually for the browser env import {algoliasearch} from "algoliasearch/dist/algoliasearch.umd.js"
@shortcuts
Was it working with v4?
Yes. On v4 it was working flawlessly but since v5 I cannot build my project :(
You can also try to install them manually (
@algolia/client-personalization
and so on)
I installed the dependencies mentioned in the error logs with:
npm install @algolia/client-personalization @algolia/client-analytics @algolia/client-abtesting;
but still the same error occurs.
Hi,
we've encountered the same error, and we were able to work around it by modifying _node_modules/.pnpm/algoliasearch@5.1.1/nodemodules/algoliasearch/dist/algoliasearch/builds/node.d.ts
from this:
import type { AbtestingClient } from '@algolia/client-abtesting';
import type { Region as AbtestingRegion } from '@algolia/client-abtesting/src/abtestingClient';
import type { AnalyticsClient } from '@algolia/client-analytics';
import type { Region as AnalyticsRegion } from '@algolia/client-analytics/src/analyticsClient';
import type { ClientOptions } from '@algolia/client-common';
import type { PersonalizationClient } from '@algolia/client-personalization';
import type { Region as PersonalizationRegion } from '@algolia/client-personalization/src/personalizationClient';
import type { RecommendClient } from '@algolia/recommend';
import type { InitClientOptions, InitClientRegion, GenerateSecuredApiKeyOptions, GetSecuredApiKeyRemainingValidityOptions } from './models';
export * from './models';
export declare const apiClientVersion = "5.1.1";
to this:
import type { AbtestingClient } from '@algolia/client-abtesting';
import type { Region as AbtestingRegion } from '@algolia/client-abtesting/dist/src/abtestingClient';
import type { AnalyticsClient } from '@algolia/client-analytics';
import type { Region as AnalyticsRegion } from '@algolia/client-analytics/dist/src/analyticsClient';
import type { ClientOptions } from '@algolia/client-common';
import type { PersonalizationClient } from '@algolia/client-personalization';
import type { Region as PersonalizationRegion } from '@algolia/client-personalization/dist/src/personalizationClient';
import type { RecommendClient } from '@algolia/recommend';
import type { InitClientOptions, InitClientRegion, GenerateSecuredApiKeyOptions, GetSecuredApiKeyRemainingValidityOptions } from './models';
export * from './models';
export declare const apiClientVersion = "5.1.1";
since the import path does not match the folder structure
I have also managed to reproduce this using version "5.1.1"
.
Hey there, thanks for providing more context to the issue!
Could you please let me know if the latest version fixes the issue on your side?
@shortcuts I tried with the latest version (5.2.1) but having the same issue. So I looked into the error file and saw imports whose paths don't exist (@algolia/client-abtesting/src/abtestingClient). So I just updated code to import from base package and it worked.
Basically:
- import type { AbtestingClient } from '@algolia/client-abtesting';
- import type { Region as AbtestingRegion } from '@algolia/client-abtesting/src/abtestingClient';
+ import type { AbtestingClient, Region as AbtestingRegion } from '@algolia/client-abtesting';
Can you re-open the issue?
@shortcuts I tried with the latest version (5.2.1) but having the same issue. So I looked into the error file and saw imports whose paths don't exist (@algolia/client-abtesting/src/abtestingClient). So I just updated code to import from base package and it worked.
Basically:
- import type { AbtestingClient } from '@algolia/client-abtesting'; - import type { Region as AbtestingRegion } from '@algolia/client-abtesting/src/abtestingClient'; + import type { AbtestingClient, Region as AbtestingRegion } from '@algolia/client-abtesting';
Can you re-open the issue?
Hey, thanks for testing it! it was fixed in 5.2.2, could you retry please?
Hi, I tried 5.2.2 and it worked. Thanks.
Lets goooo enjoy!! Thanks you
Encountering the same issue with algoliasearch@5.7.0
../../node_modules/@algolia/client-common/src/transporter/helpers.ts(12,5): error TS2322: Type 'TData | undefined' is not assignable to type 'TData'.
'TData' could be instantiated with an arbitrary type which could be unrelated to 'TData | undefined'.
../../node_modules/@algolia/client-common/src/transporter/helpers.ts(13,5): error TS2322: Type 'TData | undefined' is not assignable to type 'TData'.
'TData' could be instantiated with an arbitrary type which could be unrelated to 'TData | undefined'.
../../node_modules/@algolia/client-common/src/transporter/helpers.ts(72,5): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
husky - pre-commit hook exited with code 1 (error)
It seems TypeScript (5.5.4 but also tried with 5.6.2 (latest)) doesn't respect the package.json
exports
field and still reads node_modules/@algolia/client-common/index.ts
and its subtree from src/
instead of the dist/
files.
Removing node_modules/@algolia/client-common/index.ts
solves the issue
Same problem as above here
Im using ^5.7.0
hey @Mandy9943 @valeriangalliat it seems related to https://github.com/algolia/algoliasearch-client-javascript/issues/1561, which should be fixed with https://github.com/algolia/api-clients-automation/pull/3966
I think I am getting the same (or a similar) error:
No matching export in "node_modules/@algolia/client-abtesting/dist/builds/browser.js" for import "Status"
I can see that all the dependencies of algoliasearch (V 5.9.1) are installed.
Not sure how to fix or what to try. Open to suggestions. (Please let me know if I should create a new issue for this).
Edit to add link to reproduction of bug:
https://stackblitz.com/edit/sveltejs-kit-template-default-qmp5ae?file=src%2Froutes%2F%2Bpage.svelte
@5.7.0
I'm also facing the same issue.
Steps to reproduce:
tsc
commandSee below error
Things Already Tried
npm install
andnpm update
node_modules
dir and reinstalling npm pacages