我学点,我试图运行一个示例应用程序我从混帐拉:NodeJS示例应用程序无法启动,无法找到'config'?
https://github.com/madhums/node-express-mongoose-demo
以下所有的指令后,当我运行
npm start
我得到一个错误,即
> [email protected] start /Users/adam419/Desktop/Programming/JSPractice/node-express-mongoose-demo
> NODE_PATH=./config:./app/controllers NODE_ENV=development ./node_modules/.bin/nodemon server.js
20 Dec 16:45:19 - [nodemon] v1.2.1
20 Dec 16:45:19 - [nodemon] to restart at any time, enter `rs`
20 Dec 16:45:19 - [nodemon] watching: *.*
20 Dec 16:45:19 - [nodemon] starting `node --harmony server.js`
WARNING: No configurations found in configuration directory:
WARNING: /Users/adam419/Desktop/Programming/JSPractice/node-express-mongoose-demo/config
WARNING: See https://www.npmjs.org/package/config for more information.
module.js:340
throw err;
^
Error: Cannot find module 'undefined/config/imager.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/adam419/Desktop/Programming/JSPractice/node-express-mongoose-demo/app/models/article.js:10:20)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
20 Dec 16:45:20 - [nodemon] app crashed - waiting for file changes before starting...
这确保我已经MongoDB的安装并运行后occcurs,确保我有安装了所有的依赖包括'配置'。事实上,在节点壳,当我运行
require('config')
结果不确定。
为什么这个应用程序无法启动?
实际上,node_modules目录中有一个名为config的文件夹,require('../../ config')也不起作用。 –