Error using @dfinity/nns package

Hi,

Within my frontend I would like to use the @dfinity/nns package:

import type { ListProposalsRequest, ProposalInfo } from “@dfinity/nns”;

So I have included the latest NNS package:

However when building the application I get the following error:

Any help appreciated.
Thanks,
James

Given the error msg and as document (see README of the library here https://github.com/dfinity/ic-js/tree/main/packages/nns#installation or here https://www.npmjs.com/package/@dfinity/nns) you need the appropriate peer dependencies.

In your case @dfinity/nns-proto seems to be missing.

Thanks, I tried this but I get a lot of dependency errors.

Is there a specific version of vite and sveltekit that is recommended when using the NNS packages?

Thanks,
James

Is there a specific version of vite and sveltekit that is recommended when using the NNS packages?

Nope, those are not related.

There is absolutely no references of any @dfinity/... in the stacktrace you shared. So, this last error has nothing to do with any NNS or other IC libs.

It tells you that you have some conflicts in your svelte and vite dependencies. You have vite 5 but your sveltekit version requires vite 4.

Cool,

I just updated my packages to

@sveltejs/adapter-static”: “^3.0.0”,
@sveltejs/kit”: “^2.0.3”

which I got from your Juno package.json.

Then nns-proto installed.

Thanks mate

1 Like