这就是要做什么的错误,我创建了一个socket.io聊天应用程序。
这是一个使用nodejs.socket.io和package.json的聊天应用程序-
Package.json
"dependencies": {
"body-parser": "~1.15.1",
"connect-flash": "^0.1.1",
"connect-mongo": "^1.3.2",
"cookie-parser": "^1.4.3",
"debug": "~2.3.2",
"escape-html": "^1.0.3",
"express": "~4.14.0",
"express-session": "^1.14.2",
"hbs": "~4.0.0",
"mongoose": "^4.6.8",
"morgan": "~1.7.0",
"passport": "^0.3.2",
"passport-facebook": "^2.1.1",
"passport.socketio": "^3.7.0",
"serve-favicon": "~2.3.0",
"shortid": "^2.2.6",
"socket.io": "^1.5.1",
"twemoji": "^2.2.0"
},
"devDependencies": {
"babel-preset-es2015": "^6.18.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
"gulp-babel": "^6.1.2",
"gulp-clean-css": "^2.0.13",
"gulp-htmlmin": "^3.0.0",
"gulp-imagemin": "^3.1.1",
"gulp-sass": "*",
"gulp-uglify": "^2.0.0"
}
}C:\Users\AAKASH\Desktop\Follower-Github\Chat-app-all-F-2\Babble-master\B
abble-master\node_modules\passport-oauth2\lib\strategy.js:82
if (!options.clientID) { throw new TypeError('OAuth2Strategy requires
a clientID option'); }
^
TypeError: OAuth2Strategy requires a clientID option
at Strategy.OAuth2Strategy (C:\Users\AAKASH\Desktop\Follower-Github\
Chat-app-all-F-2\Babble-master\Babble-master\node_modules\passport-oauth
2\lib\strategy.js:82:34)
at new Strategy (C:\Users\AAKASH\Desktop\Follower-Github\Chat-app-al
l-F-2\Babble-master\Babble-master\node_modules\passport-facebook\lib\str
ategy.js:54:18)
at Object.<anonymous> (C:\Users\AAKASH\Desktop\Follower-Github\Chat-
app-all-F-2\Babble-master\Babble-master\config\passport.js:11:14)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\AAKASH\Desktop\Follower-Github\Chat-
app-all-F-2\Babble-master\Babble-master\routes\index.js:9:14)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\AAKASH\Desktop\Follower-Github\Chat-
app-all-F-2\Babble-master\Babble-master\app.js:23:16)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! babble@0.1.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the babble@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additi
onal logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\AAKASH\AppData\Roaming\npm-cache\_logs\2018-06-08T
03_18_29_207Z-debug.log 以下是无用的..。
这就是要做什么的错误,我创建了一个socket.io聊天应用程序。这是一个使用nodejs.socket.io的聊天应用程序,使用package.jsonThis是要做什么的错误,我已经创建了一个socket.io聊天应用程序。这是一个使用nodejs.socket.io的聊天应用程序,使用package.jsonThis是要做什么的错误,我已经创建了一个socket.io聊天应用程序。这是一个使用nodejs.socket.io和package.json的聊天应用程序
发布于 2020-11-06 04:35:45
最近,我遇到了同样的问题,后来我意识到我忘记了需要.env配置。
错误
TypeError: OAuth2Strategy requires a clientID option修复
npm i dotenv然后在你的文件顶部要求它
require(dotenv).config()造成此问题的原因是您的服务器不知道它必须使用环境变量。
发布于 2020-02-25 02:22:15
我昨天也犯了同样的错误。错误
TypeError: OAuth2Strategy requires a clientID option我将客户机id重命名为clientID,而不是clientId。
passport.use(new FacebookStrategy({
clientID: FACEBOOK_CLIENT_ID, // previously was clientId
clientSecret: FACEBOOK_CLIENT_SECRET,
callbackURL: FACEBOOK_CALLBACK_URL,
profileFields: ['id', 'email', 'first_name', 'last_name'],
},
UserControllers.facebookCallback,
));发布于 2019-05-05 19:00:53
我也有过一种类似的场景,用谷歌的PassportforGoogleOAuth2。同样的错误最终被证明是微不足道的。在我的代码中的某个地方,插入了部分cliendID键(在我的例子中是在keys.js下),而不是导出S,而是有一个错误导出。
module.exports = require('./something');解决了这个问题。希望有人能发现它有用。
https://stackoverflow.com/questions/50752930
复制相似问题