반응형
로컬호스트에서 테스트하거나 EC2에서 작업해도 문제가 없는 소스였다. GCP AppEngine에 올리려고 하자 이런 오류를 만났다.
2020-03-09 11:00:01 default[20200309t195715] "GET / HTTP/1.1" 500
2020-03-09 11:00:03 default[20200309t195715] internal/modules/cjs/loader.js:638
2020-03-09 11:00:03 default[20200309t195715] throw err;
2020-03-09 11:00:03 default[20200309t195715] ^
2020-03-09 11:00:03 default[20200309t195715]
2020-03-09 11:00:03 default[20200309t195715] Error: Cannot find module '/srv/bin/www' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Function.Module.runMain (internal/modules/cjs/loader.js:831:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
2020-03-09 11:00:39 default[20200309t195715] "GET / HTTP/1.1" 500
2020-03-09 11:00:40 default[20200309t195715] internal/modules/cjs/loader.js:638
2020-03-09 11:00:40 default[20200309t195715] throw err;
2020-03-09 11:00:40 default[20200309t195715] ^
2020-03-09 11:00:40 default[20200309t195715]
2020-03-09 11:00:40 default[20200309t195715] Error: Cannot find module '/srv/bin/www' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Function.Module.runMain (internal/modules/cjs/loader.js:831:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
package.json을 확인해보자
적어도 아래 라인이 존재해야한다.
"main": "app.js"
그리고 나같은 경우에는 아래 쿼리가 문제였다. 여기가 /bin/www로 되어 있었다.
"scripts": {
"start": "node app.js"
},
반응형