나는 급행 js에있는 상대 URL에 관하여 혼동한다. app.js 및 config.js 내가 "을 my_app"폴더에서 오전 (응용 프로그램 폴더) 및 응용 프로그램을 실행합니다 : 는 I 2 파일이 app.js에서express js - require ('config.js')
:을 my_app 폴더
var config = require('config.js');
// => throw err : Cannot find module 'config.js'
var config = require('/config.js');
// => throw err : Cannot find module '/config.js'
var config = require('./config.js');
// => throw err : Cannot find module 'http://localhost:3000/config.js'
var config = require(__dirname + '/config.js');
// => throw err : Cannot find module 'http://localhost:3000/config.js'
입니다? 안쪽에서 시작하지만 명령을 요구하지 않습니다.
start
-- controllers
-- models
-- node_modules
-- public
-- views
app.js
config.js
package.json
router.js
나 진보주십시오 :
이 내 구조입니다! 감사!
node_modules 폴더가 있습니까? –
물론 있습니다. –
찾을 수 있습니까? –