Update all dependencies in package.json
npm i -g npm-check-updates && ncu -u && npm i
npm update
npm install
[!] CocoaPods could not find compatible versions for pod “Firebase/CoreOnly”:
Delete ios/Podfile.lock and then run (in ios folder):
pod install
How to read .env file in nodejs
We need to install the dotenv
package using:
npm install dotenv
And then on top of the root file (main.js
or index.js
) call that module like this:
// based on require | import
require('dotenv').config();
// or
import 'dotenv/config'
// then access the values like this:
console.log(process.env.SOME_KEY)
Difference between require and import
Require is pre-es6 method, while import is new. More differences:
listen EACCES: permission denied 0.0.0.0:80
Ports below 1024 are considered priviledged ports and only admin user can open them. Either run your app as a priviledged user or else change the port to more than 1024.
To run as admin / sudo:
sudo node app.js
// or
sudo npm start