节点应用程序没有运行在我的电脑上,但运行良好与我的团队的其他电脑(使用Git)

我们的团队使用Node.js服务器创build一个项目,并使用Gi​​tHub作为源代码控制。 问题是当我将运行服务器。 我使用下一步来testing主服务器是否会启动应用程序。

git checkout master git pull npm update node .\backend\server.js 

最后的评论给我下一个错误。

 D:\***\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 (D:\Documenten\WatchFriends\Web\node_modules\passport-oauth2\lib\strategy.js:82:34) at new Strategy (D:\Documenten\WatchFriends\Web\node_modules\passport-google-oauth20\lib\strategy.js:52:18) at module.exports.config (D:\Documenten\WatchFriends\Web\backend\data\passport.js:94:18) at Object.<anonymous> (D:\Documenten\WatchFriends\Web\backend\server.js:16:1) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3 

其他团队合作伙伴也在同一个存储库上工作,已经完成了相同的步骤来testing主服务器是否可以运行。 奇怪的问题是他们没有任何问题。 另外, .gitignore文件忽略的configuration文件是相同的。

问题:为什么代码不能在我的电脑上运行,而是会在其他电脑上运行?

我试图从GitHub中删除并重新login项目,重新安装节点模块并添加被忽略的文件。 但是这并不能解决这个错误。 我在节点版本6.9.3和git版本2.10.2.windows.1 woking。

更新:

  • 这里是我们的GitHub项目的链接: github.com/WatchFriends/Web
  • 这是Travis的build立状态 构建状态 (只需ckecking一些吞咽任务,但也是npm run build
  • 这里是链接到Travis: travis-ci.org/WatchFriends/Web
  • 在GitHub上configurationTravis: ./.travis.yml . ./.travis.yml

     install: - npm install - npm install -g angular-cli language: node_js script: - gulp html - gulp scss - gulp ts - gulp node node_js: - "6.9" cache: directories: - node_modules - bower_components 

这就是为什么你应该使用像Travis,Circle或者Codeship这样的持续集成系统在一个干净的系统上运行你的testing,以避免应用程序不能正常工作,而是有人说“它在我的系统上运行”。

显然你的系统必须与代码工作的系统有所不同。 您可以安装不同的软件,运行不同的服务,不同的库,不同的环境variables,不同的操作系统,或者在安装或启动应用程序时做不同的事情。

开始使用CI,你会立即看到什么是错的。

另外使用npm来启动你的服务:

 npm start 

所以你知道你正在运行与其他人一样的命令。