CI找不到相关的模块要求

CI找不到相关的模块要求

本文介绍了Travis-CI找不到相关的模块要求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行Mocha测试的Travis构建作业,但是构建失败并显示以下错误:



错误:找不到模块'./sources/reddit'



我的文件树如下

  feeds / 
来源/
Reddit.js
Feeds.js
app.js

我正在执行Feeds.js

  var https = require('https'),
q = require('q'),
Reddit = require('./ sources / reddit');

不过,它似乎在标记加载错误。

解决方案

此错误是因为我引用了 ./ sources / reddit reddit 小写,在文件系统上,文件为 Reddit ,大写字母为 R



Mac OSX的大小写敏感度很好,Linux则不然。

I have a Travis build job that is running mocha tests, however the build is failing with the error:

Error: Cannot find module './sources/reddit'

My file tree is the following

feeds/
     sources/
          Reddit.js
     Feeds.js
app.js

Within Feeds.js I am doing

var https   = require('https'),
    q       = require('q'),
    Reddit  = require('./sources/reddit');

However it seems to be flagging up an error loading it up.

解决方案

This error is because I was referencing ./sources/reddit with reddit as lowercase, on the filesystem the file is Reddit with an uppercase R.

Mac OSX deals with case sensitivity well, Linux does not.

这篇关于Travis-CI找不到相关的模块要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 16:39