xxxxxxxxxx
//In CMD
// npm i dotenv
//in JS file
const env = require('dotenv');
const app = express();
env.config({
path: './config/.env'
});
//use
const PORT = process.env.PORT;
xxxxxxxxxx
npm install --save-dev @babel/core@^7.0.0-0 #Install latest babel version
# Solve this issue upgrading outdated version of Babel installed.
xxxxxxxxxx
Update your npm packages by using:
`
# to install
npm install -g npm-check-updates
# to use
npx npm-check-updates -u
npm install
`
xxxxxxxxxx
'This error message is related to a version mismatch between Babel and the required version specified in your project's dependencies.
'Babel is a JavaScript transpiler that allows you to use next-generation JavaScript syntax in older browsers. It seems that your project requires Babel version 7.0.0-0, but the installed version is 6.26.3.
'To resolve this issue, you can try updating Babel to the required version. You can do this by running the following command in your terminal:
npm install babel@^7.0.0-0
'If you're using yarn, the equivalent command would be:
yarn add babel@^7.0.0-0
xxxxxxxxxx
Installing latest version of babel or the required version of babel might work for you
xxxxxxxxxx
import * as dotenv from 'dotenv' // see https://github.com/motdotla/dotenv#how-do-i-use-dotenv-with-import
dotenv.config()
import express from 'express'