okta / samples-nodejs-express-4

Express 4 samples. Will publish an artifact that can be consumed by end-to-end sample repos
Other
120 stars 120 forks source link

I am getting below exception on npm start. #32

Closed tusharbudhe0302 closed 6 years ago

tusharbudhe0302 commented 6 years ago

Unable to configure ExpressOIDC { RequestError: connect ECONNREFUSED 127.0.0.1:7777 at ClientRequest.req.once.err (C:\TFS\nodejs-okta-api\node_modules\got\index.js:219:22) at Object.onceWrapper (events.js:315:30) at emitOne (events.js:121:20) at ClientRequest.emit (events.js:211:7) at Socket.socketErrorListener (_http_client.js:387:9) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7) at emitErrorNT (internal/streams/destroy.js:64:8) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9) name: 'RequestError', code: 'ECONNREFUSED', host: '127.0.0.1:7777', hostname: '127.0.0.1', method: 'GET', path: '/oauth2/default/.well-known/openid-configuration', protocol: 'http:', url: 'http://127.0.0.1:7777/oauth2/default/.well-known/openid-configura

jmelberg-okta commented 6 years ago

@tusharbudhe0302: Looks like the mock-server hasn't been started. As noted in the quickstart, you can start it by running:

npm run mock-okta
tusharbudhe0302 commented 6 years ago

Yes try that too. It's showing some proxy error.

Tapes stored in: C:\TFS\nodejs-okta-api\tools\mock-okta\tapes Server started: http://127.0.0.1:7777 Proxying: http://rain.okta1.com:1802 events.js:183 throw er; // Unhandled 'error' event ^

Error: listen EADDRINUSE :::7777 at Object._errnoException (util.js:1024:11) at _exceptionWithHostPort (util.js:1046:20) at Server.setupListenHandle [as _listen2] (net.js:1351:14) at listenInCluster (net.js:1392:12) at Server.listen (net.js:1476:7) at Object. (C:\TFS\nodejs-okta-api\tools\mock-okta\index.js:328:24) at Module._compile (module.js:635:30) at Object.Module._extensions..js (module.js:646:10) at Module.load (module.js:554:32) at tryModuleLoad (module.js:497:12) at Function.Module._load (module.js:489:3) at Function.Module.runMain (module.js:676:10) at startup (bootstrap_node.js:187:16) at bootstrap_node.js:608:3 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @okta/samples-nodejs-express-4@3.0.0 mock-okta: node tools/mock-okta npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @okta/samples-nodejs-express-4@3.0.0 mock-okta script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:_logs\2017-12-29T14_32_59_478Z-debug.log

jmelberg-okta commented 6 years ago

Looks like this is throwing an error because the port is in use.

Try the following:

# -- For Windows ---
# Find the pid of the process
netstat -ano | findstr :7777

# Kill the connection
tskill {pid} 
# -- Other ---
kill $( lsof -i:7777 -t )

Then, restart it:

# Start the mock server
npm run mock-okta

# In another terminal
npm start
tusharbudhe0302 commented 6 years ago

I did as you suggested. Now I am getting different exception. I am using windows7

npm start

@okta/samples-nodejs-express-4@3.0.0 prestart C:\nodejs-okta-api build-frontend

'DIST_OUT' is not recognized as an internal or external command, operable program or batch file. child_process.js:644 throw err; ^

Error: Command failed: DIST_OUT=C:\TFS\nodejs-okta-api\dist npm run build at checkExecSyncError (child_process.js:601:13) at execSync (child_process.js:641:13) at Object. (C:\nodejs-okta-api\node_modules\@okta\samples-js-angular-1\scripts\build-frontend.js:23:1) at Module._compile (module.js:635:30) at Object.Module._extensions..js (module.js:646:10) at Module.load (module.js:554:32) at tryModuleLoad (module.js:497:12) at Function.Module._load (module.js:489:3) at Function.Module.runMain (module.js:676:10) at startup (bootstrap_node.js:187:16) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @okta/samples-nodejs-express-4@3.0.0 prestart: build-frontend npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @okta/samples-nodejs-express-4@3.0.0 prestart script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

nbarbettini commented 6 years ago

DIST_OUT is not recognized... is the issue detailed in #18.

jmelberg-okta commented 6 years ago

Closing this issue as it is a duplicate of #18