Giter VIP home page Giter VIP logo

cat.js's Issues

getType undefined

createError Function内,当err类型为object时,会调用未定义函数getType。进程会因此挂掉,麻烦修复,谢谢

找不到 app.config.js 的问题

Hi,在部署 node.js 应用时发现,如果不在 node.js 项目文件夹里面启动,而是在外层文件夹启动 node.js 应用,将会找不到 app.config.js 文件。

错误日志:[AppConfig] No avaliable app.config.js found in /opt/tars/apps/100004256

具体原因是因为, app.config.js 的查询方式为

var appConfig={};
var lastConfigDir='';
var dirname=path.resolve(".");
while (dirname!==lastConfigDir){
	try {
		var config=path.resolve(dirname,'./app.config.js');
		appConfig=require(config);
		if (!appConfigHidden){
			console.log('[AppConfig] Load config from '+config);
		}
		break;
	}catch (e){
		if (!appConfigHidden){
			console.log('[AppConfig] No avaliable app.config.js found in '+dirname);
		}
		lastConfigDir=dirname;
		dirname=path.dirname(lastConfigDir);
	}
}

其中,var dirname=path.resolve("."); 默认以 process.cwd() node.js 的启动目录为基准,一层层往外找父目录。

如果改成 var dirname= __dirname;,将以 appConfig.js 文件所在的目录往上找,通常该文件在 node_modules文件夹 里,所以应该会在 node.js 项目的文件夹内,此时不管 process.cwd() 指向哪个目录,都不会影响 app.config.js 的查找方式。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.