How to solve ‘ReferenceError: window is not defined’ when importing Vue plugin in Nuxt.JS

I need to use Vue plugin named vue-flash-message in Nuxt.JS. I installed it via NPM and created file vue-flash-message.js in folder plugins. import Vue from ‘vue’;import VueFlashMessage from ‘vue-flash-message’;Vue.use(VueFlashMessage); Then I tried to run `npm run dev` to test whether the plugin works. But it doesn’t work. The reason is the default mode of Nuxt is SSR. The… Read More How to solve ‘ReferenceError: window is not defined’ when importing Vue plugin in Nuxt.JS

Fix error when install npm package as global package

Today, I will guide you to fix error when install npm package as global package. I ran below command to install npm package as global package but installation was failed. Command: sudo npm install -g electron Error will look like: Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/electron/.electron’ npm ERR! code ELIFECYCLE npm ERR! errno 1 npm… Read More Fix error when install npm package as global package

Keep database connection on connecting to MySQL/MariaDB using SQLAlchemy

You want the database connection will be keep on connect to MySQL/MariaDB, just use pool_recycle parameter in method create_engine(). Example: create_engine(db_url, pool_recycle=1) pool_recycle this setting causes the pool to recycle connections after the given number of seconds has passed. It defaults to -1, or no timeout. For example, setting to 3600 means connections will be… Read More Keep database connection on connecting to MySQL/MariaDB using SQLAlchemy