In case you use .env
file, let’s use grep
or eval
to get a value environment variable from the .env file.
Updated start2
as @Paul suggested:
"scripts": {
"start": "NODE_ENV=$(grep NODE_ENV .env | cut -d '=' -f2) some_script",
"start2": "eval $(grep '^NODE_ENV' .env) && some_script"
}
More Related Contents:
- What’s the difference between tilde(~) and caret(^) in package.json?
- What’s the difference between dependencies, devDependencies and peerDependencies in npm package.json file?
- How to set environment variables from within package.json?
- npm install private github repositories by dependency in package.json
- npm ERR cb() never called
- Is there a way to get version from package.json in nodejs code?
- How to use private Github repo as npm dependency
- How to deploy node app that uses grunt to heroku
- How do I fix a vulnerable npm package in my package-lock.json that isn’t listed in the package.json?
- How to set env var for .npmrc use
- What’s the difference between dependencies, devDependencies, and peerDependencies in NPM package.json file?
- Find the version of an installed npm package
- NPM Install Error:Unexpected end of JSON input while parsing near ‘…nt-webpack-plugin”:”0’
- Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’
- Using npm behind corporate proxy .pac
- npm WARN package.json: No repository field
- How to npm install to a specified directory?
- can you host a private repository for your organization to use with npm?
- Angular2 QuickStart npm start is not working correctly
- Node Sass couldn’t find a binding for your current environment
- npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
- How to consume npm modules from typescript?
- How to install npm -g on offline server
- Error “npm WARN package.json: No repository field”
- Browserify – How to call function bundled in a file generated through browserify in browser
- What is the difference between res.send and res.write in express?
- Jest gives `Cannot find module` when importing components with absolute paths
- Is there any way to fix package-lock.json lockfileVersion so npm uses a specific format?
- Cannot uninstall angular-cli
- How to store a file with file extension with multer?