Yuliang-Lee / vue2-smooth-scroll

:surfer:Simple vue smooth scroll
MIT License
121 stars 18 forks source link

TypeError: Cannot read properties of null (reading 'Vue') when deploying with Netlify #46

Closed DRD161 closed 2 years ago

DRD161 commented 3 years ago

Tooling: Vue.js & Gridsome Chakra UI Vue Netlify Mac OS Catalina 10.15.7 Webstorm 2021.2.2 Firefox 92

When using vue2-smooth-scroll locallty I have no issues, it is not until I go to deploy my site with Netlify do I get the following TypeError during the Netlify build step (gridsome build).

TypeError: Cannot read properties of null (reading 'Vue') 8:53:24 PM: at Module. (node_modules/vue2-smooth-scroll/dist/vue-smooth-scroll.min.js:1:3059) 8:53:24 PM: at n (node_modules/vue2-smooth-scroll/dist/vue-smooth-scroll.min.js:1:331) 8:53:24 PM: at module.exports.WliE (node_modules/vue2-smooth-scroll/dist/vue-smooth-scroll.min.js:1:1134) 8:53:24 PM: at assets/js/app.38fc5f3e.js:6567:992 8:53:24 PM: at assets/js/app.38fc5f3e.js:6567:37 8:53:24 PM: at Object.WliE (node_modules/vue2-smooth-scroll/dist/vue-smooth-scroll.min.js:1:210) 8:53:24 PM: at webpack_require (webpack/bootstrap:25:0) 8:53:24 PM: at Module.O/VM (assets/js/app.38fc5f3e.js:4514:29) 8:53:24 PM: at webpack_require (webpack/bootstrap:25:0) 8:53:24 PM: at Object.0 (assets/js/app.38fc5f3e.js:277:18)

I am using vue2-smooth-scroll globally in my main.js file as shown below:

Vue.use(VueSmoothScroll, { duration: 1100 });

Any help would be greatly appreciated.

Yuliang-Lee commented 2 years ago

seems this problem was cause by missing Vue object, make sure import Vue lib in Netify environment