我學點,我試圖運行一個示例應用程序我從混帳拉: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')也不起作用。 –