TypeError: Cannot read property 'v4' of undefined

Viewed 4316

Am getting this error in vue

vue.esm.js?efeb:628 [Vue warn]: Error in v-on handler: "TypeError: Cannot read property 'v4' 
of undefined"

found in

---> <AddTodo> at src/components/AddTodo.vue
   <App> at src/App.vue
     <Root>

I have already installed uuid so v4 should be working but it is not.

2 Answers

I got same error and I solved it.

import {v4} from 'uuid';

const uuId = v4()

Maybe I'm late to the party

import * as uuid from 'uuid';

Now you can call anything from uuid. Such as,

uuid.v4();

Hope this helps

Related