Moves dotenv from dependencies to devDepencies in package.json. dotenv is a runtime dependency, and this change will fix issues if NODE_ENV=production or other causes under which dependencies are installed but not devDependencies.
Prior behavior
export NODE_ENV=production
npm install
ISSUER={validOktaDomain}/oauth2/default CLIENT_ID={validClientId} CLIENT_SECRET={validClientSecret} npm run okta-hosted-login-server
Resulted in:
> @okta/samples-nodejs-express-4@3.1.0 okta-hosted-login-server
> node okta-hosted-login/server.js
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'dotenv'
Require stack:
- /(...)/samples-nodejs-express-4/config.js
- /(...)/samples-nodejs-express-4/okta-hosted-login/server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/Users/derek.tiffany/Documents/GitHub/samples-nodejs-express-4/config.js:2:16)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/(...)/samples-nodejs-express-4/config.js',
'/(...)/samples-nodejs-express-4/okta-hosted-login/server.js'
]
}
New behavior
The above now results in:
> @okta/samples-nodejs-express-4@3.1.0 okta-hosted-login-server
> node okta-hosted-login/server.js
(...)
App started on port 8080
Description
Moves
dotenv
fromdependencies
todevDepencies
inpackage.json
.dotenv
is a runtime dependency, and this change will fix issues ifNODE_ENV=production
or other causes under which dependencies are installed but not devDependencies.Prior behavior
export NODE_ENV=production
npm install
ISSUER={validOktaDomain}/oauth2/default CLIENT_ID={validClientId} CLIENT_SECRET={validClientSecret} npm run okta-hosted-login-server
Resulted in:
New behavior
The above now results in:
Resolves
114