vue-instantsearch not compatible with vue-cli 3? Could not find a declaration file for module 'vue-instantsearch'.

Created on 2 May 2018  Β·  15Comments  Β·  Source: algolia/vue-instantsearch

I was able to run npm install --save vue-instantsearch successfully, but when starting the server, I get the following error:
ERROR in /data/src/main.ts Could not find a declaration file for module 'vue-instantsearch'. '/data/node_modules/vue-instantsearch/dist/vue-instantsearch.common.js' implicitly has an 'any' type. Try 'npm install @types/vue-instantsearch' if it exists or add a new declaration (.d.ts) file containing 'declare module 'vue-instantsearch';'

As suggested, when I try npm install @types/vue-instantsearch, I get:
npm install @types/vue-instantsearch npm ERR! code E404 npm ERR! 404 Not Found: @types/vue-instantsearch@latest

I am using the new vue-cli 3, could this be a compatibility issue with this component?

Most helpful comment

Confirmed. πŸ‘πŸΌπŸ‘πŸΌπŸ‘πŸΌ No more declaration error. Thanks for the fix!

All 15 comments

Hey! Seems like you’re adding typescript too. Can you make a repository which throws these errors?

Hey I work with @bwentzloff. Just going to chime in here. When I tried this (exact same setup), got the same error, again using vue-cli-3, and yes, using typescript. But when I attempted to use the components in App.vue, everything works as expected - even though we're still getting that could not find declaration error in the terminal when running npm run serve. ??

There's no typescript definition of Vue InstantSearch, you'll have to write your own (possible to write a simple stub which simply declares the module).

I'll gladly take a look on how to do it if I have a complete git repo to clone and try things around.

Thanks!

I threw up a quick repo with our exact vue app setup and the sample best buy code from your vue docs. (keep in mind that we are using vue-cli-3 when we set this up, just in case that has any impact)

https://github.com/nolawill/vue-ais-typescript

Run the npm install and npm run serve and you should see the same declaration error. Thanks for taking a look for us!

Made it work, feel free to get back if that didn't do it https://github.com/nolawill/vue-ais-typescript/pull/1

screen shot 2018-05-03 at 17 42 08

πŸ™Œ

Confirmed. πŸ‘πŸΌπŸ‘πŸΌπŸ‘πŸΌ No more declaration error. Thanks for the fix!

is there a fix for this for those of use not using typescript? I am using vanilla js and vue-instantsearch does not work with vue-cli 3;

All examples use Vue CLI 3. Can you please post a failing reproducible example @sbrunswig?

would you happen to have a link to an example of a vue cli 3. The one on algolia's website is still using 2.0:
https://community.algolia.com/vue-instantsearch/getting-started/getting-started.html. I am trying vue create, where as this example is using vue init. In the meantime I will put some code up, thanks for the quick reply.

Here is the code: https://github.com/sbrunswig/vue-instantsearch,
Pretty simple to reproduce:

  1. vue create instant-search
  2. npm i --save vue-instantsearch
  3. replace main.js and app.vue with code in this example https://community.algolia.com/vue-instantsearch/getting-started/getting-started.html
  4. npm run serve
  5. open localhost:8080 and get console error unknown custom element <ais-index>

ive tried importing directly into app.vue also but still can find the modules

thanks, will give that link a shot

As said earlier, you are looking at the docs for v1, not the docs for v2 of Vue InstantSearch, the link I gave is the correct of the one you're using

yep had streams crossed thanks

On Mon, Mar 4, 2019, 7:23 AM Haroen Viaene notifications@github.com wrote:

As said earlier, you are looking at the docs for v1, not the docs for v2
of Vue InstantSearch, the link I gave is the correct of the one you're using

β€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/algolia/vue-instantsearch/issues/442#issuecomment-469251362,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA6TTABlS26Tc-5NaIOaI3TcBNKcrR1vks5vTR5qgaJpZM4Tv3kq
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rayrutjes picture rayrutjes  Β·  3Comments

samouss picture samouss  Β·  3Comments

shaunnez picture shaunnez  Β·  3Comments

abattenburg picture abattenburg  Β·  4Comments

rayrutjes picture rayrutjes  Β·  4Comments