Topic: Cannot set property $notify of #<Vue> which has only a getter

jaccordeiro free asked 3 years ago


Expected behavior **https://mdbootstrap.com/docs/vue/advanced/notifications/** Import the component following the documents provided: import Vue from 'vue'; import 'bootstrap-css-only/css/bootstrap.min.css'; import 'mdbvue/build/css/mdb.css'; import App from './App.vue' import Notify from 'mdbvue';

Vue.use(Notify);

Actual behavior I had a first error that was easily solved by using a suggestion of another user: import Vue from 'vue'; import 'bootstrap-css-only/css/bootstrap.min.css'; import 'mdbvue/build/css/mdb.css'; import App from './App.vue' import {Notify} from 'mdbvue';

Vue.use(Notify);

But now the following error appears:

Notify.js?4b36:28 Uncaught TypeError: Cannot set property $notify of # which has only a getter at Object.install (Notify.js?4b36:28) at Function.Vue.use (vue.esm.js?efeb:5110) at eval (main.js?1c90:47) at Object../src/main.js (app.js:19348) at webpack_require (app.js:708) at fn (app.js:113) at Object.1 (app.js:21933) at webpack_require (app.js:708) at app.js:806 at app.js:809

Thank you in advance,

Resources (screenshots, code snippets etc.)


jaccordeiro free answered 3 years ago


Thank you for your reply! After examining the application I finally understood it was a conflict between the notify of mdb and the vue-notifyjs already existing in the application. I removed the latter and it's working fine now.

Thank you!


Magdalena Dembna staff commented 3 years ago

I'm glad everything worked out fine. Good luck with your project, Magdalena


Magdalena Dembna staff answered 3 years ago


Hi, Can you provide a code snippet in which you're using $notify ? It's not clear to me where exactly the problem occurs - We import it in node_modules/mdbvue/src/main.js so there's no need to import Notify once again if you have mdbvue in your dependencies in package.json. $notify is added to Vue's prototype. Kind regards, Magdalena


FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Closed

Specification of the issue

  • User: Free
  • Premium support: No
  • Technology: MDB Vue
  • MDB Version: 5.2.0
  • Device: computer
  • Browser: chrome
  • OS: windows 10
  • Provided sample code: No
  • Provided link: Yes