找不到模块' jws'

时间:2016-02-21 21:05:29

标签: single-sign-on ibm-cloud

当我的应用程序推送到没有本地node_modules的Bluemix并添加passport-idaas-openidconnect依赖项时,我得到以下错误,它说问题是我的应用程序而不是npm,但错误来自/home/vcap/app/node_modules/passport-idaas-openidconnect/lib/strategy.js:8:11

ERR module.js:338
ERR;
ERR           ^
ERRor: Cannot find module 'jws'
ERR     at Function.Module._resolveFilename (module.js:336:15)
ERR     at Function.Module._load (module.js:278:25)
ERR     at Module.require (module.js:365:17)
ERR     at require (module.js:384:17)
ERR     at Object.<anonymous> (/home/vcap/app/node_modules/passport-idaas-openidconnect/lib/strategy.js:8:11)
ERR     at Module._compile (module.js:460:26)
ERR     at Object.Module._extensions..js (module.js:478:10)
ERR     at Module.load (module.js:355:32)
ERR     at Function.Module._load (module.js:310:12)
ERR     at Module.require (module.js:365:17)
ERR     at require (module.js:384:17)
ERR! Linux 3.19.0-25-generic
ERR! argv "/home/vcap/app/vendor/node/bin/node" "/home/vcap/app/vendor/node/bin/npm" "start"
ERR! node v0.12.10
ERR! npm  v2.14.9
ERR! code ELIFECYCLE
ERR! myapp@0.4.2 start: `node app.js`
ERR! Exit status 1
ERR!
ERR! Failed at the myapp@0.4.2 start script 'node app.js'.
ERR! This is most likely a problem with the myapp package,
ERR! not with npm itself.
ERR! Tell the author that this fails on your system:
ERR!     node app.js
ERR! You can get their info via:
ERR!     npm owner ls myappe
ERR! There is likely additional logging output above.
ERR! Please include the following file with any support request:
ERR!     /home/vcap/app/npm-debug.log
ERR Instance (index 0) failed to start accepting connections

1 个答案:

答案 0 :(得分:0)

为了使用Bluemix SSO服务推送具有SSO功能的Node.js应用程序,您的package.json文件中至少需要以下依赖项:

"dependencies": {
    [...]
    "cookie-parser": "^1.4.1",
    "express": "^4.12.4",
    "express-session": "^1.13.0",
    "passport": "^0.2.2",
    "passport-idaas-openidconnect": "^1.0.0"
    [...]
  }

请注意,passport-idaas-openidconnect模块适用于0.1.1至0.3.2的护照版本。如Bluemix Single Sign On Docs - Configuring apps中所述,版本低于0.3.2的版本可能无法正常工作。