• 카테고리

    질문 & 답변
  • 세부 분야

    프론트엔드

  • 해결 여부

    미해결

start script 누락 오류가 떠서 질문드립니다

21.09.15 16:23 작성 조회수 3.71k

0

안녕하세요 제로초님

 

server.js만든후 express와 cross-env를 만들고 

package.json에

"start""cross-env PORT=80 NODE_ENV=production node server",

이렇게 추가도 하였습니다

그 후 npm start를 하는데

root@ip-172-31-26-247:/home/ubuntu/VUE.SNS/ch1/front# npm start

npm ERR! missing script: start

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2021-09-15T07_12_41_448Z-debug.log

이러한 오류가 뜹니다 ㅜ

무엇이 문제인지 구글링도 해보고 찾아봤는데  해결하지 못하여 질문드립니다.

피드백 주시면 감사하겠습니다!

package.json

{
  "name""vue-nodebird-front",
  "version""1.0.0",
  "description""",
  "main""index.js",
  "scripts": {
    "dev""nuxt",
    "build""nuxt build",
    "start""cross-env PORT=80 NODE_ENV=production node server",
    "lint""eslint **/*"
  },
  "author""",
  "license""ISC",
  "dependencies": {
    "@nuxtjs/axios""^5.13.6",
    "@nuxtjs/moment""^1.6.1",
    "@nuxtjs/vuetify""^1.12.1",
    "axios""^0.21.1",
    "cross-env""^7.0.3",
    "express""^4.17.1",
    "lodash.throttle""^4.1.1",
    "nuxt""^2.15.7",
    "vue""^2.6.14",
    "vuetify""^2.5.6"
  },
  "devDependencies": {
    "eslint""^7.31.0",
    "eslint-plugin-vue""^7.14.0"
  }
}

server.js

const { loadNuxtbuild } = require('nuxt')

const app = require('express')()
const isDev = process.env.NODE_ENV !== 'production'
const port = process.env.PORT || 3080

async function start() {
  // We get Nuxt instance
  const nuxt = await loadNuxt(isDev ? 'dev' : 'start')

  // Render every route with Nuxt.js
  app.use(nuxt.render)

  // Build only in dev mode with hot-reloading
  if (isDev) {
    build(nuxt)
  }
  // Listen the server
  app.listen(port'0.0.0.0')
  console.log('Server listening on `localhost:' + port + '`.')
}

start()

참고할 코드 보내드립니다!

 

 

 

 

답변 1

답변을 작성해보세요.

0

ch1/front 폴더가 맞나요?

문종현님의 프로필

문종현

질문자

2021.09.15

server.js 있는 부분말인가요?? 예 server.js은 ch1 front에 존재하고 ch1 front에서 cross-env와 express설피도 하였습니다

문종현님의 프로필

문종현

질문자

2021.09.15

아 예 ch1  front맞습니다 저 챕터를 나누고 하지 않고 계속 덮어씌워가면서 수업들어서 ch1 front 맞습니다

missing scripts start는 package.json에 start가 없다는 것인데 분명히 있거든요. 그렇다면 명령어를 입력하는 경로가 잘못되었을 겁니다. ch1/front 폴더 바로 아래에 package.json이 있나요?

문종현님의 프로필

문종현

질문자

2021.09.15

예 제로초님

ch1/front 폴더 바로 아래 package.json있습니다. 마찬가지로 server.js 또한 ch1/front 폴더 바로 아래 있구요!ㅜㅜ

문종현님의 프로필

문종현

질문자

2021.09.15

혹시 서버에서 npm i 할때

root@ip-172-31-26-247:/home/ubuntu/VUE.SNS/ch1/front# npm i

npm WARN vue-nodebird-front@1.0.0 No description

npm WARN vue-nodebird-front@1.0.0 No repository field.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})     

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})    

 

audited 1232 packages in 8.318s

 

93 packages are looking for funding

  run `npm fund` for details

 

found 2 moderate severity vulnerabilities

  run `npm audit fix` to fix them, or `npm audit` for details

root@ip-172-31-26-247:/home/ubuntu/VUE.SNS/ch1/front#

 

터미널에서 이런식으로 뜨는데 여기서 잘못 된걸까요??

 

여기는 문제 없습니다. npm run start 해도 똑같나요?

문종현님의 프로필

문종현

질문자

2021.09.15

예 npm run start해도 같은 에러가 뜹니다 ㅜㅜ

 

root@ip-172-31-26-247:/home/ubuntu/VUE.SNS/ch1/front# npm run start

npm ERR! missing script: start

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2021-09-15T08_47_55_271Z-debug.log

root@ip-172-31-26-247:/home/ubuntu/VUE.SNS/ch1/front#

이렇게요 ㅜ

아 강의 거의 다 들어가고 있는데 여기서 이렇게 갑자기 막히네유 ㅠㅠ

거기서 cat package.json 하고 결과 복붙해주세요.

문종현님의 프로필

문종현

질문자

2021.09.16

감사합니다!

cat package.json 하고 결과 복붙 하라는 말씀이 저 상태에서 package.json 파일 스크립트와 터미널에 나온 결과를 복붙 해달라는 말씀이신가요??

 

네 ch1/front 경로에서 명령어 입력하세요

문종현님의 프로필

문종현

질문자

2021.09.16

예 알겠습니다!

package.json

{
  "name""vue-nodebird-front",
  "version""1.0.0",
  "description""",
  "main""index.js",
  "scripts": {
    "dev""nuxt",
    "build""nuxt build",
    "start""cross-env PORT=80 NODE_ENV=production node server",
    "lint""eslint **/*"
  },
  "author""",
  "license""ISC",
  "dependencies": {
    "@nuxtjs/axios""^5.13.6",
    "@nuxtjs/moment""^1.6.1",
    "@nuxtjs/vuetify""^1.12.1",
    "axios""^0.21.1",
    "cross-env""^7.0.3",
    "express""^4.17.1",
    "lodash.throttle""^4.1.1",
    "nuxt""^2.15.7",
    "vue""^2.6.14",
    "vuetify""^2.5.6"
  },
  "devDependencies": {
    "eslint""^7.31.0",
    "eslint-plugin-vue""^7.14.0"
  }
}


npm start 와 npm  run start를 입력했을때의 터미널 오류

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front# npm start

npm ERR! missing script: start

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2021-09-16T02_34_26_945Z-debug.log

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front# npm run start

npm ERR! missing script: start

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2021-09-16T02_35_19_652Z-debug.log

 

감사합니다!!

참고로 깃허브에 푸쉬하고 git pull도 했습니다

 

저 package.json이 cat package.json 명령어 입력한 후에 나온 거 긁어서 복사하신 건가요? 소스 코드가 아니라 명령어의 결과를 알려달라고 말씀드린겁니다.

문종현님의 프로필

문종현

질문자

2021.09.16

아! 알겠습니다

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front# cat package.json

{

  "name": "vue-nodebird-front",

  "version": "1.0.0",

  "description": "",

  "main": "index.js",

  "scripts": {

    "dev": "nuxt"

  },

  "author": "",

  "license": "ISC",

  "dependencies": {

    "express": "^4.17.1",

    "nuxt": "^2.15.7",

    "vue": "^2.6.14"

  }

}

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front#

이렇게 뜹니다 ㅜ

start 없잖아요. git pull 안 받으신 거 아니에요?

문종현님의 프로필

문종현

질문자

2021.09.16

어 !

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front# git pull

Already up to date.

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front#

이거 보시면 이미 깃풀 한 상태인데 왜 이렇게 뜨는지 모르겠네요 

 

분명히 깃헙에 푸쉬하고 터미널에서 git pull 했는데 왜 package.json에 start가 없는건지 ㅜㅜ

깃헙에서 코드 확인해보세요.

문종현님의 프로필

문종현

질문자

2021.09.16

예 방금 깃헙에 들어가서 코드를 확인해 봤는데 package.json 코드를

근데 방금 cat package.json이후에 나온 거랑 똑같네요 ㅜㅜ 

gitignore에서 푸쉬 하지 말라고 한것도 아닌데

왜 이게 깃허브에 업로드가 안되는지... 

문종현님의 프로필

문종현

질문자

2021.09.16

아 제로초님 이거 혹시

지금 제가 확인해 보니까 cat package.json 이후에 나온게 깃헙에서 브랜치 만들기전 master의 package.json과 같습니다!

따로 브랜치를 만들어서 거기에 푸쉬하면서 강의를 듣고 있는데 그 브랜치에 가니까 잘 푸쉬가 되어있습니다 !!

이거 문제 인건가요???

master에 push를 하세요 아니면 git pull받을 때 해당 브랜치로 checkout(전환)하세요.

문종현님의 프로필

문종현

질문자

2021.09.16

감사합니다!!

제로초님 제가 질문을 최대한 안하려고 하고있긴한데...ㅎㅎ 계속 찾아보면서 하고있습니다 근데 진행이 안돼서 여쭤봅니다 ㅜ

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front# git branch -a

* develop

  master

  remotes/origin/HEAD -> origin/master

  remotes/origin/develop

  remotes/origin/master

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front#

git branch -a로 봣는데 현재 develop에 별표시가 있으면 해당브랜치로 전환 된거 맞나요??ㅜ

 

특정 브랜치에서 pull 받아오는건 git pull origin <branch name>

이거 라고 해서  해봤는데

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front# git pull origin develop

From https://github.com/MoonJonghyeon/VUE.SNS

 * branch              develop    -> FETCH_HEAD

Updating 495fb8c1..3027e30b

error: Your local changes to the following files would be overwritten by merge:

        ch1/front/node_modules/tar/lib/extract.js

        ch1/front/node_modules/tar/lib/list.js

        ch1/front/node_modules/tar/lib/mkdir.js

        ch1/front/node_modules/tar/lib/pack.js

        ch1/front/node_modules/tar/lib/path-reservations.js

        ch1/front/node_modules/tar/lib/read-entry.js

        ch1/front/node_modules/tar/lib/replace.js

        ch1/front/node_modules/tar/lib/unpack.js

        ch1/front/node_modules/tar/lib/write-entry.js

        ch1/front/node_modules/tar/package.json

        ch1/front/package-lock.json

        ch1/front/package.json

Please commit your changes or stash them before you merge.

error: The following untracked working tree files would be overwritten by merge:

        ch1/front/node_modules/array-flatten/LICENSE

        ch1/front/node_modules/array-flatten/README.md

        ch1/front/node_modules/array-flatten/array-flatten.js

        ch1/front/node_modules/array-flatten/package.json

        ch1/front/node_modules/body-parser/HISTORY.md

        ch1/front/node_modules/body-parser/LICENSE

        ch1/front/node_modules/body-parser/README.md

        ch1/front/node_modules/body-parser/index.js

        ch1/front/node_modules/body-parser/lib/read.js

        ch1/front/node_modules/body-parser/lib/types/json.js

        ch1/front/node_modules/body-parser/lib/types/raw.js

        ch1/front/node_modules/body-parser/lib/types/text.js

        ch1/front/node_modules/body-parser/lib/types/urlencoded.js

        ch1/front/node_modules/body-parser/node_modules/bytes/History.md

        ch1/front/node_modules/body-parser/node_modules/bytes/LICENSE

        ch1/front/node_modules/body-parser/node_modules/bytes/Readme.md

        ch1/front/node_modules/body-parser/node_modules/bytes/index.js

        ch1/front/node_modules/body-parser/node_modules/bytes/package.json

        ch1/front/node_modules/body-parser/node_modules/debug/.coveralls.yml

        ch1/front/node_modules/body-parser/node_modules/debug/.eslintrc

        ch1/front/node_modules/body-parser/node_modules/debug/.npmignore

        ch1/front/node_modules/body-parser/node_modules/debug/.travis.yml

        ch1/front/node_modules/body-parser/node_modules/debug/CHANGELOG.md

        ch1/front/node_modules/body-parser/node_modules/debug/LICENSE

        ch1/front/node_modules/body-parser/node_modules/debug/Makefile

        ch1/front/node_modules/body-parser/node_modules/debug/README.md

        ch1/front/node_modules/body-parser/node_modules/debug/component.json

        ch1/front/node_modules/body-parser/node_modules/debug/karma.conf.js

        ch1/front/node_modules/body-parser/node_modules/debug/node.js

        ch1/front/node_modules/body-parser/node_modules/debug/package.json

        ch1/front/node_modules/body-parser/node_modules/debug/src/browser.js

        ch1/front/node_modules/body-parser/node_modules/debug/src/debug.js

        ch1/front/node_modules/body-parser/node_modules/debug/src/index.js

        ch1/front/node_modules/body-parser/node_modules/debug/src/inspector-log.js

        ch1/front/node_modules/body-parser/node_modules/debug/src/node.js

        ch1/front/node_modules/body-parser/node_modules/http-errors/HISTORY.md

        ch1/front/node_modules/body-parser/node_modules/http-errors/LICENSE

        ch1/front/node_modules/body-parser/node_modules/http-errors/README.md

        ch1/front/node_modules/body-parser/node_modules/http-errors/index.js

        ch1/front/node_modules/body-parser/node_modules/http-errors/package.json

        ch1/front/node_modules/body-parser/node_modules/inherits/LICENSE

        ch1/front/node_modules/body-parser/node_modules/inherits/README.md

        ch1/front/node_modules/body-parser/node_modules/inherits/inherits.js

        ch1/front/node_modules/body-parser/node_modules/inherits/inherits_browser.js

        ch1/front/node_modules/body-parser/node_modules/inherits/package.json

        ch1/front/node_modules/body-parser/node_modules/ms/index.js

        ch1/front/node_modules/body-parser/node_modules/ms/license.md

        ch1/front/node_modules/body-parser/node_modules/ms/package.json

        ch1/front/node_modules/body-parser/node_modules/ms/readme.md

        ch1/front/node_modules/body-parser/node_modules/qs/.editorconfig

        ch1/front/node_modules/body-parser/node_modules/qs/.eslintignore

        ch1/front/node_modules/body-parser/node_modules/qs/.eslintrc

        ch1/front/node_modules/body-parser/node_modules/qs/CHANGELOG.md

        ch1/front/node_modules/body-parser/node_modules/qs/LICENSE

        ch1/front/node_modules/body-parser/node_modules/qs/README.md

        ch1/front/node_modules/body-parser/node_modules/qs/dist/qs.js

        ch1/front/node_modules/body-parser/node_modules/qs/lib/formats.js

        ch1/front/node_modules/body-parser/node_modules/qs/lib/index.js

        ch1/front/node_modules/body-parser/node_modules/qs/lib/parse.js

        ch1/front/node_modules/body-parser/node_modules/qs/lib/stringify.js

        ch1/front/node_modules/body-parser/node_modules/qs/lib/utils.js

        ch1/front/node_modules/body-parser/node_modules/qs/package.json

        ch1/front/node_modules/body-parser/node_modules/qs/test/.eslintrc

        ch1/front/node_modules/body-p

Aborting

이렇게 뜹니다 ㅜ

 

git reset --hard 후에 다시 git pull 받으세요. 그리고 cat package.json으로 업데이트 되었나 확인하세요.

문종현님의 프로필

문종현

질문자

2021.09.16

cat package.json 에 다 들어온것을 확인했습니다!!

근데 이후에 npm start를 하니

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front# npm start

 

> vue-nodebird-front@1.0.0 start /home/ubuntu/VUE.SNS/ch1/front

> cross-env PORT=80 NODE_ENV=production node server

 

 

 FATAL  No build files found in /home/ubuntu/VUE.SNS/ch1/front/.nuxt/dist/server.                                                                           05:22:49

Use either `nuxt build` or `builder.build()` or start nuxt in development mode.

 

  Use either `nuxt build` or `builder.build()` or start nuxt in development mode.

  at VueRenderer._ready (node_modules/@nuxt/vue-renderer/dist/vue-renderer.js:758:13)

  at async Server.ready (node_modules/@nuxt/server/dist/server.js:637:5)

  at async Nuxt._init (node_modules/@nuxt/core/dist/core.js:482:7)

 

(node:12854) UnhandledPromiseRejectionWarning: Error: No build files found in /home/ubuntu/VUE.SNS/ch1/front/.nuxt/dist/server.

Use either `nuxt build` or `builder.build()` or start nuxt in development mode.

    at VueRenderer._ready (/home/ubuntu/VUE.SNS/ch1/front/node_modules/@nuxt/vue-renderer/dist/vue-renderer.js:758:13)

    at async Server.ready (/home/ubuntu/VUE.SNS/ch1/front/node_modules/@nuxt/server/dist/server.js:637:5)

    at async Nuxt._init (/home/ubuntu/VUE.SNS/ch1/front/node_modules/@nuxt/core/dist/core.js:482:7)

(node:12854) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

(node:12854) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

이러한 에러가 뜨는데 번역기에 돌려보니 파일이 없다는거 같은데 무슨 잘못때문에 에러가 발생한지 알 수 있을까요??ㅜㅜ

문종현님의 프로필

문종현

질문자

2021.09.16

아예 프론트의 노드 모듈을 삭제하고 다시 설치하고 npm start를 쳐보니 

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front# npm start

 

> vue-nodebird-front@1.0.0 start /home/ubuntu/VUE.SNS/ch1/front

> cross-env PORT=80 NODE_ENV=production node server

 

sh: 1: cross-env: Permission denied

npm ERR! code ELIFECYCLE

npm ERR! errno 126

npm ERR! vue-nodebird-front@1.0.0 start: `cross-env PORT=80 NODE_ENV=production node server`

npm ERR! Exit status 126

npm ERR!

npm ERR! Failed at the vue-nodebird-front@1.0.0 start script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2021-09-16T06_03_28_985Z-debug.log

 

이러한 에러가 뜹니다 ㅜㅜ 계속 반복 되는 오류네요 

여기서 npm rebuild 치면 바로 위의 오류가 뜨구요 ㅜㅜㅜㅜㅜ

 

다른질문에서 제로초님이 노드모듈 지우고 sudo npm i로 해보라 하셔서 프론트에 있는 노드모듈 지우고  해봤는데 같은 오류가 뜹니다ㅜ

npm start 하기 전에 npm run build 먼저 하셔야죠.

문종현님의 프로필

문종현

질문자

2021.09.16

예 npm run build 하면

 

rroot@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front# npm run build

 

> vue-nodebird-front@1.0.0 build /home/ubuntu/VUE.SNS/ch1/front

> nuxt build

 

 

<--- Last few GCs --->

 

[13896:0x3b97e20]    41245 ms: Mark-sweep 482.5 (495.7) -> 476.1 (493.0) MB, 1094.8 / 0.0 ms  (average mu = 0.303, current mu = 0.204) allocation failure scavenge might not succeed

[13896:0x3b97e20]    41459 ms: Scavenge 479.6 (493.0) -> 476.5 (493.0) MB, 5.7 / 0.0 ms  (average mu = 0.303, current mu = 0.204) allocation failure

[13896:0x3b97e20]    41522 ms: Scavenge 480.8 (493.7) -> 476.9 (493.5) MB, 2.7 / 0.0 ms  (average mu = 0.303, current mu = 0.204) allocation failure

 

 

<--- JS stacktrace --->

 

==== JS stack trace =========================================

 

    0: ExitFrame [pc: 0x140dc19]

Security context: 0x3bb2535808d1 <JSObject>

    1: queue [0x10f03aaa9f01] [/home/ubuntu/VUE.SNS/ch1/front/node_modules/jiti/dist/babel.js:~13] [pc=0x1ec0eb1f8b42](this=0x328a87c19a61 <JSObject>,0x1043fdd478c9 <String[#1]:  >)

    2: space [0x10f03aaa90d1] [/home/ubuntu/VUE.SNS/ch1/front/node_modules/jiti/dist/babel.js:~13] [pc=0x1ec0eb1fd7c7](this=0x328a87c12719 <p map = 0x1041d47bcb69>,0x1043fdd404b1 <und...

 

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

 1: 0xa1a640 node::Abort() [node]

 2: 0xa1aa4c node::OnFatalError(char const*, char const*) [node]

 3: 0xb9a62e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]

 4: 0xb9a9a9 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]

 5: 0xd57c25  [node]

 6: 0xd582b6 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]

 7: 0xd64b75 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]

 8: 0xd65a25 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]

 9: 0xd684dc v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]

10: 0xd2eefb v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]

11: 0x10714ce v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]

12: 0x140dc19  [node]

Aborted (core dumped)

npm ERR! code ELIFECYCLE

npm ERR! errno 134

npm ERR! vue-nodebird-front@1.0.0 build: `nuxt build`

npm ERR! Exit status 134

npm ERR!

npm ERR! Failed at the vue-nodebird-front@1.0.0 build script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2021-09-16T06_32_36_245Z-debug.log

이렇게 뜹니다 ㅜ

그리고 나서 npm start하면 

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front# npm start

 

> vue-nodebird-front@1.0.0 start /home/ubuntu/VUE.SNS/ch1/front

> cross-env PORT=80 NODE_ENV=production node server

 

 

 FATAL  No build files found in /home/ubuntu/VUE.SNS/ch1/front/.nuxt/dist/server.                                                                           06:25:36

Use either `nuxt build` or `builder.build()` or start nuxt in development mode.

 

  Use either `nuxt build` or `builder.build()` or start nuxt in development mode.

  at VueRenderer._ready (node_modules/@nuxt/vue-renderer/dist/vue-renderer.js:758:13)

  at async Server.ready (node_modules/@nuxt/server/dist/server.js:637:5)

  at async Nuxt._init (node_modules/@nuxt/core/dist/core.js:482:7)

 

(node:13782) UnhandledPromiseRejectionWarning: Error: No build files found in /home/ubuntu/VUE.SNS/ch1/front/.nuxt/dist/server.

Use either `nuxt build` or `builder.build()` or start nuxt in development mode.

    at VueRenderer._ready (/home/ubuntu/VUE.SNS/ch1/front/node_modules/@nuxt/vue-renderer/dist/vue-renderer.js:758:13)

    at async Server.ready (/home/ubuntu/VUE.SNS/ch1/front/node_modules/@nuxt/server/dist/server.js:637:5)

    at async Nuxt._init (/home/ubuntu/VUE.SNS/ch1/front/node_modules/@nuxt/core/dist/core.js:482:7)

(node:13782) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

(node:13782) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

이렇게 위와 같은 오류가 뜨구요 ㅜ

 

서버 메모리가 부족한 겁니다. 무료 인스턴스 상에서는 빌드가 어려우니 로컬에서 빌드해서 .nuxt 폴더를 github에 올려서 서버에서 git pull 받으세요. 그 후 npm start 하세요.

문종현님의 프로필

문종현

질문자

2021.09.16

피드백 감사합니다 제로초님!! nuxt를 깃헙에 올려서 npm start를 하니 이번엔 다른 오류가 뜹니다....ㅜㅜㅜ

구글링해서 찾아보고있긴한데 

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front# npm start

 

> vue-nodebird-front@1.0.0 start /home/ubuntu/VUE.SNS/ch1/front

> cross-env PORT=80 NODE_ENV=production node server

 

internal/modules/cjs/loader.js:258

    throw e;

    ^

 

SyntaxError: Error parsing /home/ubuntu/VUE.SNS/ch1/front/node_modules/cross-env/package.json: Unexpected token < in JSON at position 283

    at parse (<anonymous>)

    at readPackage (internal/modules/cjs/loader.js:245:20)

    at readPackageScope (internal/modules/cjs/loader.js:270:19)

    at shouldUseESMLoader (internal/modules/run_main.js:36:15)

    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:55:24)

    at internal/main/run_main_module.js:17:47 {

  path: '/home/ubuntu/VUE.SNS/ch1/front/node_modules/cross-env/package.json'

}

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! vue-nodebird-front@1.0.0 start: `cross-env PORT=80 NODE_ENV=production node server`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the vue-nodebird-front@1.0.0 start script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2021-09-16T07_12_56_603Z-debug.log

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front# 

이오류인데 뭔가 타입핑 오류 같기도 하고 구글링해서 찾아보니 어딘가에 쌍따옴표를 써야한다는 에러라고 말하는 사람도 있습니다 근데 정확한 문제를 모르겠어서 다시 한번 질문 드립니다!!!ㅜ

node_modules를 지웠다가 다시 npm i 해서 설치해보세요. 흔한 에러는 아닙니다.

문종현님의 프로필

문종현

질문자

2021.09.16

예!
프론트의 노드 모듈 지우고 다시 설치했습니다

PS C:\Users\com\vue강좌\vuesns\ch1\front> npm i

npm WARN vue-nodebird-front@1.0.0 No description

npm WARN vue-nodebird-front@1.0.0 No repository field.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})    

 

audited 1381 packages in 10.951s

 

107 packages are looking for funding

  run `npm fund` for details

 

found 2 moderate severity vulnerabilities

  run `npm audit fix` to fix them, or `npm audit` for details

이 WARNNING들은 무시하고 다시 프론트 연결하고, 후에 서버 터미널로 가서 git pull 하는데 

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front# git pull

error: Pulling is not possible because you have unmerged files.

hint: Fix them up in the work tree, and then use 'git add/rm <file>'

hint: as appropriate to mark resolution and make a commit.

fatal: Exiting because of an unresolved conflict.

이렇게 에러 같은게 뜹니다 ㅜㅜ 병합안된 파일이 있어서 pull이 안된다는거 같은데 

어떻게 해결해야하는지...모르겠네요 ㅜ 프론트 강의 보다 진짜 훨 어렵네요 ㅜ

문종현님의 프로필

문종현

질문자

2021.09.16

git pull 하지 않은 상태에서 npm start를 해보면 

 

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front# npm start

 

> vue-nodebird-front@1.0.0 start /home/ubuntu/VUE.SNS/ch1/front

> cross-env PORT=80 NODE_ENV=production node server

 

 

 FATAL  No build files found in /home/ubuntu/VUE.SNS/ch1/front/.nuxt/dist/server.                                                                           08:46:05

Use either `nuxt build` or `builder.build()` or start nuxt in development mode.

 

  Use either `nuxt build` or `builder.build()` or start nuxt in development mode.

  at VueRenderer._ready (node_modules/@nuxt/vue-renderer/dist/vue-renderer.js:758:13)

  at async Server.ready (node_modules/@nuxt/server/dist/server.js:637:5)

  at async Nuxt._init (node_modules/@nuxt/core/dist/core.js:482:7)

 

(node:3347) UnhandledPromiseRejectionWarning: Error: No build files found in /home/ubuntu/VUE.SNS/ch1/front/.nuxt/dist/server.

Use either `nuxt build` or `builder.build()` or start nuxt in development mode.

    at VueRenderer._ready (/home/ubuntu/VUE.SNS/ch1/front/node_modules/@nuxt/vue-renderer/dist/vue-renderer.js:758:13)

    at async Server.ready (/home/ubuntu/VUE.SNS/ch1/front/node_modules/@nuxt/server/dist/server.js:637:5)

    at async Nuxt._init (/home/ubuntu/VUE.SNS/ch1/front/node_modules/@nuxt/core/dist/core.js:482:7)

(node:3347) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

(node:3347) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

다시 이게 뜹니다 계속 오류 2개가 반복이나는 형태입니다ㅜ

아까 명령어 둘 다 알려드렸습니다. 깃에서 충돌나면 git reset --hard 하시고

 FATAL  No build files found in

에러는 npm run build 하세요. 서버에서 안 되면 .nuxt 가져오시고요.

문종현님의 프로필

문종현

질문자

2021.09.17

피드백 정말 감사합니다!!!

제로초님 이 주신 피드백 계속 돌려 봐가며 진행중에 있는데

npm run build 와 npm start를 치면

 

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front# npm start

 

> vue-nodebird-front@1.0.0 start /home/ubuntu/VUE.SNS/ch1/front

> cross-env PORT=80 NODE_ENV=production node server

 

sh: 1: cross-env: not found

npm ERR! code ELIFECYCLE

npm ERR! syscall spawn

npm ERR! file sh

npm ERR! errno ENOENT

npm ERR! vue-nodebird-front@1.0.0 start: `cross-env PORT=80 NODE_ENV=production node server`

npm ERR! spawn ENOENT

npm ERR!

npm ERR! Failed at the vue-nodebird-front@1.0.0 start script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2021-09-17T04_30_01_078Z-debug.log

root@ip-172-31-3-111:/home/ubuntu/VUE.SNS/ch1/front# npm run build

 

> vue-nodebird-front@1.0.0 build /home/ubuntu/VUE.SNS/ch1/front

> nuxt build

 

sh: 1: nuxt: Permission denied

npm ERR! code ELIFECYCLE

npm ERR! errno 126

npm ERR! vue-nodebird-front@1.0.0 build: `nuxt build`

npm ERR! Exit status 126

npm ERR!

npm ERR! Failed at the vue-nodebird-front@1.0.0 build script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2021-09-17T04_31_43_628Z-debug.log

 

이러한 두 에러가 뜨는데 

다른 질문에서 제로초님이 sudo npm run build 해보라 하셔서 그대로 했는데 같은에러가 뜹니다 ㅜ

cat package.json으로 확인해봐도 cross-env도 있고, nuxt도 있는데 왜 저렇게 에러가 뜨는걸까요 ㅜㅜ 부탁드립니다!ㅜ

문종현님의 프로필

문종현

질문자

2021.09.17

이게 혹시 지금 aws에서

이부분에서 연결을 누르지 않아 생긴 현상인가요??

그래서 눌러봤는데 지금

이러한 에러가 뜨네요?ㅜㅜ 이 문제 일 수 있는 건가요??

 

인스턴스 지우고 다시 만들어서 처음부터 다시 해보세요. 많이 꼬인 것 같습니다.

문종현님의 프로필

문종현

질문자

2021.09.17

방금 인스턴스 지우고 다시 순서대로 진행해봤습니다

그런데 같은 에러가 뜹니다 ㅜ

npm start & npm run build 했을때 

 

root@ip-172-31-11-119:/home/ubuntu/VUE.SNS/ch1/front# npm start

 

> vue-nodebird-front@1.0.0 start /home/ubuntu/VUE.SNS/ch1/front

> cross-env PORT=80 NODE_ENV=production node server

 

sh: 1: cross-env: Permission denied

npm ERR! code ELIFECYCLE

npm ERR! errno 126

npm ERR! vue-nodebird-front@1.0.0 start: `cross-env PORT=80 NODE_ENV=production node server`

npm ERR! Exit status 126

npm ERR!

npm ERR! Failed at the vue-nodebird-front@1.0.0 start script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2021-09-17T05_31_31_459Z-debug.log

root@ip-172-31-11-119:/home/ubuntu/VUE.SNS/ch1/front# npm run build

 

> vue-nodebird-front@1.0.0 build /home/ubuntu/VUE.SNS/ch1/front

> nuxt build

 

sh: 1: nuxt: Permission denied

npm ERR! code ELIFECYCLE

npm ERR! errno 126

npm ERR! vue-nodebird-front@1.0.0 build: `nuxt build`

npm ERR! Exit status 126

npm ERR!

npm ERR! Failed at the vue-nodebird-front@1.0.0 build script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2021-09-17T05_31_40_109Z-debug.log

이와같은 오류가 뜹니다 ㅜㅜ 

구글링 하면서 찾아보니 run rebuild 해보라는 말이 있는데 해도 되는 명령어인지 햇갈리네요 ㅜ

문종현님의 프로필

문종현

질문자

2021.09.17

npm rebuild 후에 npm start를 해보니 

root@ip-172-31-11-119:/home/ubuntu/VUE.SNS/ch1/front# npm start

 

> vue-nodebird-front@1.0.0 start /home/ubuntu/VUE.SNS/ch1/front

> cross-env PORT=80 NODE_ENV=production node server

 

 

ℹ NuxtJS collects completely anonymous data about usage.                                                                                                    06:21:27

  This will help us improve Nuxt developer experience over time.

  Read more on https://git.io/nuxt-telemetry

 

? Are you interested in participating? Yes

 

 

 FATAL  No build files found in /home/ubuntu/VUE.SNS/ch1/front/.nuxt/dist/server.                                                                           06:21:37  

Use either `nuxt build` or `builder.build()` or start nuxt in development mode.

 

  Use either `nuxt build` or `builder.build()` or start nuxt in development mode.

  at VueRenderer._ready (node_modules/@nuxt/vue-renderer/dist/vue-renderer.js:758:13)

  at async Server.ready (node_modules/@nuxt/server/dist/server.js:637:5)

  at async Nuxt._init (node_modules/@nuxt/core/dist/core.js:482:7)

 

(node:29921) UnhandledPromiseRejectionWarning: Error: No build files found in /home/ubuntu/VUE.SNS/ch1/front/.nuxt/dist/server.

Use either `nuxt build` or `builder.build()` or start nuxt in development mode.

    at VueRenderer._ready (/home/ubuntu/VUE.SNS/ch1/front/node_modules/@nuxt/vue-renderer/dist/vue-renderer.js:758:13)

    at async Server.ready (/home/ubuntu/VUE.SNS/ch1/front/node_modules/@nuxt/server/dist/server.js:637:5)

    at async Nuxt._init (/home/ubuntu/VUE.SNS/ch1/front/node_modules/@nuxt/core/dist/core.js:482:7)

(node:29921) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

(node:29921) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

이렇게 에러가 떠서, npm run build를 했습니다.

npm run build를 하니 

root@ip-172-31-11-119:/home/ubuntu/VUE.SNS/ch1/front# npm run build

 

> vue-nodebird-front@1.0.0 build /home/ubuntu/VUE.SNS/ch1/front

> nuxt build

 

 

<--- Last few GCs --->

 

[29946:0x337be20]    47229 ms: Scavenge 484.0 (489.7) -> 483.3 (490.0) MB, 63.0 / 0.0 ms  (average mu = 0.153, current mu = 0.037) allocation failure

[29946:0x337be20]    47670 ms: Mark-sweep 484.2 (490.0) -> 477.7 (490.2) MB, 277.7 / 0.0 ms  (+ 527.6 ms in 106 steps since start of marking, biggest step 41.0 ms, walltime since start of marking 1605 ms) (average mu = 0.390, current mu = 0.586) allocatio

 

<--- JS stacktrace --->

 

==== JS stack trace =========================================

 

    0: ExitFrame [pc: 0x140dc19]

Security context: 0x35376a5008d1 <JSObject>

    1: /* anonymous */ [0x35b628ca4cb1] [/home/ubuntu/VUE.SNS/ch1/front/node_modules/jiti/dist/babel.js:~1985] [pc=0x25206dc90679](this=0x31c6a6e51341 <JSFunction c (sfi = 0x1f9685319869)>,0x3b55ac0b3a09 <ke map = 0x24beb7a3cbb9>,0x38e4a575afb1 <Object map = 0x35f6573c5c59>,0x2c11ea8738e1 <d map = 0x35f6573ca029>,0x31f1d697b389 <Object map = 0x281f070ffbd9>,0x224...

 

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

 1: 0xa1a640 node::Abort() [node]

 2: 0xa1aa4c node::OnFatalError(char const*, char const*) [node]

 3: 0xb9a62e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]

 4: 0xb9a9a9 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]

 5: 0xd57c25  [node]

 6: 0xd582b6 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]

 7: 0xd64b75 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]

 8: 0xd65a25 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]

 9: 0xd684dc v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]

10: 0xd2eefb v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]

11: 0x10714ce v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]

12: 0x140dc19  [node]

Aborted (core dumped)

npm ERR! code ELIFECYCLE

npm ERR! errno 134

npm ERR! vue-nodebird-front@1.0.0 build: `nuxt build`

npm ERR! Exit status 134

npm ERR!

npm ERR! Failed at the vue-nodebird-front@1.0.0 build script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2021-09-17T06_22_56_394Z-debug.log

이러한 에러가 다시 뜸니다 ㅜ

분명히 .nuxt 폴더를 gitignore에서 이름 지우고 깃헙에 올린 후에 git pull도 했는데도 말이죠 ㅜㅜ

git pull만하고 끝내시는것 같은데 진짜 .nuxt가 있나 ls같은 명령어로 확인을 해보세요. 처음 에러도 package.json에 scripts.start가 없는 것이었는데 직접 확인을 안 하니 모르고 질문올리셨던 겁니다.

명령어를 입력하고 나서 직접 원하는 결과가 만들어졌나 확인을 하셔야합니다.

그리고 명령어들 앞에 sudo 붙이세요.

직접 확인을 하지 않으시면 명령어 하나 입력하고 안돼서 다시 질문하고 이게 무한 반복될 뿐입니다.

문종현님의 프로필

문종현

질문자

2021.09.17

잘 알려주셔서 감사합니다 제로초님!!! 진짜 막막한 와중에 정말 큰도움 됩니다 ㅜ

지금 ls로 확인해보니 

components  layouts  middleware  node_modules  nuxt.config.js  package-lock.json  package.json  pages  server.js  static  store

이거 밖에 없네요 nuxt가 없습니다...

그 gitignore에서 .nuxt있던거 지우고 푸쉬해서 깃헙에 올린다음에 터미널에 git pull을 하면 서버에도 들어 오는게 아니었던건가요??ㅜㅜ

문종현님의 프로필

문종현

질문자

2021.09.17

소스코드로 분명히 푸쉬해서 깃헙에는 올라와있는게 확인됩니다 ㅜ

git clone 주소 로 서버에 가지고 와서 sudo npm i, git pull 도 다 해보고 ls로 체크를 해봤는데 nuxt가 들어와 있질 않네요ㅜㅜ 제가 한 방법이 틀린건가요 아니면 맞는건가요??ㅜ

브랜치 확인하셨나요? 그리고 숨길파일이라 ls -a 해야 보입니다.

문종현님의 프로필

문종현

질문자

2021.09.23

피드백 주셔서 감사합니다 제로초님! 추석 연휴라 방해 되실까 이제 답변 드립니다!

브랜치는 제가 작업하는 develop으로 잘 되어있고 ls -a 찍어보니 숨겨진 파일 .nuxt도 보입니다...ㅜㅜ

root@ip-172-31-44-135:/home/ubuntu/VUE.SNS/ch1/front# ls -a

.   .eslintignore  .gitignore  VUE.SNS     layouts     node_modules    package-lock.json  pages      static

..  .eslintrc      .nuxt       components  middleware  nuxt.config.js  package.json       server.js  store

root@ip-172-31-44-135:/home/ubuntu/VUE.SNS/ch1/front# git branch -a

* develop

  master

  remotes/origin/HEAD -> origin/master

  remotes/origin/develop

  remotes/origin/master

이렇듯 잘 보이는데 무엇이 문제인지 모르겠네요ㅜㅜ 휴 

cd .nuxt/dist 한 후에 ls해보세요. server.js가 있어야합니다.

문종현님의 프로필

문종현

질문자

2021.09.23

예!!

root@ip-172-31-44-135:/home/ubuntu/VUE.SNS/ch1/front/.nuxt# cd /dist

bash: cd: /dist: No such file or directory

root@ip-172-31-44-135:/home/ubuntu/VUE.SNS/ch1/front/.nuxt# ls

App.js    client.js   empty.js  jsonp.js      middleware.js  moment.js  router.scrollBehavior.js  server.js  utils.js  vuetify

axios.js  components  index.js  loading.html  mixins         router.js  routes.json               store.js   views

이렇게 해봤습니다

cd dist가 파일또는 디렉토리가 없다 해서 넉스트에서 ls를 확인해 봤는는데 저기 보시면 아히겠지만 server.js가 찍히는걸로 봐서는 들어가 있는게 맞는것 같습니다!

문종현님의 프로필

문종현

질문자

2021.09.23

nuxt.render 기능을 위해 server.js를 쓰는 스크립트가 제로초님과 다르더라구요 그냥 쓰긴했는데

구글링 해서 찾아보니 두개가 있습니다.

const { loadNuxt, build } = require('nuxt')

const app = require('express')()
const isDev = process.env.NODE_ENV !== 'production'
const port = process.env.PORT || 3000

async function start() {
  // We get Nuxt instance
  const nuxt = await loadNuxt(isDev ? 'dev' : 'start')

  // Render every route with Nuxt
  app.use(nuxt.render)

  // Build only in dev mode with hot-reloading
  if (isDev) {
    build(nuxt)
  }
  // Listen the server
  app.listen(port, '0.0.0.0')
  console.log('Server listening on `localhost:' + port + '`.')
}

start()

이것과 

const Nuxt = require('nuxt') const app = require('express')() const isProd = (process.env.NODE_ENV === 'production') const port = process.env.PORT || 3000 // options으로 nuxt.js를 인스턴스화 합니다. let config = require('./nuxt.config.js') config.dev = !isProd const nuxt = new Nuxt(config) // nuxt.js로 모든 route를 랜더합니다. app.use(nuxt.render) // dev 모드를 위해 핫-로딩 빌드를 합니다. if (config.dev) { nuxt.build() } // 서버 app.listen(port, '0.0.0.0') console.log('Server listening on localhost:' + port)

이게있습니다. 별차이는 없을것 같아서 두개각각 써봤는데 

오류가 뜨네요 ㅜ

root@ip-172-31-44-135:~/VUE.SNS/ch1/front# npm start

 

> vue-nodebird-front@1.0.0 start /root/VUE.SNS/ch1/front

> cross-env PORT=80 NODE_ENV=production node server

 

sh: 1: cross-env: not found

npm ERR! code ELIFECYCLE

npm ERR! syscall spawn

npm ERR! file sh

npm ERR! errno ENOENT

npm ERR! vue-nodebird-front@1.0.0 start: `cross-env PORT=80 NODE_ENV=production node server`

npm ERR! spawn ENOENT

npm ERR!

npm ERR! Failed at the vue-nodebird-front@1.0.0 start script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2021-09-23T01_14_12_674Z-debug.log

이러한 오류요 ㅜ

cat package.json으로 보면 분명히 cross-env는 들어가 있는데 왜 not found라 뜨는지 모르겠네요 ㅜ

 

문종현님의 프로필

문종현

질문자

2021.09.23

혹시나 해서 서버쪽 터미널에서 npm i cross-env를 설치하고 npm start를 해보니

root@ip-172-31-28-169:/home/ubuntu/VUE.SNS/ch1/front# npm start

 

> vue-nodebird-front@1.0.0 start /home/ubuntu/VUE.SNS/ch1/front

> cross-env PORT=80 NODE_ENV=production node server

 

 

ℹ NuxtJS collects completely anonymous data about usage.                                                                                                    03:47:18

  This will help us improve Nuxt developer experience over time.

  Read more on https://git.io/nuxt-telemetry

 

? Are you interested in participating? No

 

 

 FATAL  No build files found in /home/ubuntu/VUE.SNS/ch1/front/.nuxt/dist/server.                                                                           03:47:51  

Use either `nuxt build` or `builder.build()` or start nuxt in development mode.

 

  Use either `nuxt build` or `builder.build()` or start nuxt in development mode.

  at VueRenderer._ready (node_modules/@nuxt/vue-renderer/dist/vue-renderer.js:758:13)

  at async Server.ready (node_modules/@nuxt/server/dist/server.js:637:5)

  at async Nuxt._init (node_modules/@nuxt/core/dist/core.js:482:7)

 

(node:8300) UnhandledPromiseRejectionWarning: Error: No build files found in /home/ubuntu/VUE.SNS/ch1/front/.nuxt/dist/server.

Use either `nuxt build` or `builder.build()` or start nuxt in development mode.

    at VueRenderer._ready (/home/ubuntu/VUE.SNS/ch1/front/node_modules/@nuxt/vue-renderer/dist/vue-renderer.js:758:13)

    at async Server.ready (/home/ubuntu/VUE.SNS/ch1/front/node_modules/@nuxt/server/dist/server.js:637:5)

    at async Nuxt._init (/home/ubuntu/VUE.SNS/ch1/front/node_modules/@nuxt/core/dist/core.js:482:7)

(node:8300) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

(node:8300) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

이러한 에러가 뜨네요 ㅜ

그래서 제로초님이 이 때 npm run build하라고 하셔서 해보니

root@ip-172-31-28-169:/home/ubuntu/VUE.SNS/ch1/front# npm run build

 

> vue-nodebird-front@1.0.0 build /home/ubuntu/VUE.SNS/ch1/front

> nuxt build

 

sh: 1: nuxt: Permission denied

npm ERR! code ELIFECYCLE

npm ERR! errno 126

npm ERR! vue-nodebird-front@1.0.0 build: `nuxt build`

npm ERR! Exit status 126

npm ERR!

npm ERR! Failed at the vue-nodebird-front@1.0.0 build script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2021-09-23T03_49_50_064Z-debug.log

이러한 에러가 다시 발생하네요 ㅜ 

(node:29921) UnhandledPromiseRejectionWarning: Error: No build files found in /home/ubuntu/VUE.SNS/ch1/front/.nuxt/dist/server.

여기를 잘 봐보세요. 서버를 실행하면 .nuxt/dist/server.js를 원합니다. 그런데 저희는 .nuxt/server.js가 있습니다. nuxt를 빌드할 때 .nuxt/dist에 빌드해야 하는데, .nuxt에 빌드한 겁니다. 빌드 경로를 바꿔야 하는 겁니다.

https://nuxtjs.org/docs/directory-structure/nuxt/

에러 메시지 모든 줄을 다 읽어보셔야 합니다.

문종현님의 프로필

문종현

질문자

2021.09.23

예 알겠습니다!

server.js 스크립트 문제였던것 같습니다!

근데 server.js 스크립트 수정 후 npm start를 하면 아래 보시다시피 localhost:80이 나왔다 메모리 부족? 과 같은 문제가 나타남니다

root@ip-172-31-30-117:/home/ubuntu/VUE.SNS/ch1/front# npm start

 

> vue-nodebird-front@1.0.0 start /home/ubuntu/VUE.SNS/ch1/front

> cross-env PORT=80 NODE_ENV=production node server

 

Server listening on `localhost:80`.

 

<--- Last few GCs --->

 

[8391:0x3e36d20]    21619 ms: Mark-sweep 488.1 (490.2) -> 487.4 (490.5) MB, 1317.0 / 0.0 ms  (average mu = 0.037, current mu = 0.003) allocation failure scavenge might not succeed

 

 

<--- JS stacktrace --->

 

==== JS stack trace =========================================

 

    0: ExitFrame [pc: 0x140dc19]

Security context: 0x1c23f12808d1 <JSObject>

    1: s [0x3deded0f04b1] [/home/ubuntu/VUE.SNS/ch1/front/node_modules/jiti/dist/babel.js:~1985] [pc=0x13fd418c333a](this=0x23e082f10921 <Object map = 0x347ec9fabc29>,0x150525c15d49 <ke map = 0x18befb970229>,0x0ad7c91804b1 <undefined>,0x0ad7c91804b1 <undefined>)

    2: /* anonymous */ [0x257d0ce6bce1] [/home/ubuntu/VUE.SNS/ch1/front/node_modules/jiti/dist/babel.j...

 

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

 1: 0xa1a640 node::Abort() [node]

 2: 0xa1aa4c node::OnFatalError(char const*, char const*) [node]

 3: 0xb9a62e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]

 4: 0xb9a9a9 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]

 5: 0xd57c25  [node]

 6: 0xd582b6 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]

 7: 0xd64b75 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]

 8: 0xd65a25 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]

 9: 0xd684dc v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]

10: 0xd2eefb v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]

11: 0x10714ce v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]

12: 0x140dc19  [node]

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! vue-nodebird-front@1.0.0 start: `cross-env PORT=80 NODE_ENV=production node server`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the vue-nodebird-front@1.0.0 start script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2021-09-23T05_51_38_115Z-debug.log

 

문종현님의 프로필

문종현

질문자

2021.09.23

그리고 강좌 마지막 부분에 npm run build를 나중에 하셔서 저도 따라 npm run build를 쳐봤는데 permission denied가 뜨네요 ㅜ

 

root@ip-172-31-30-117:/home/ubuntu/VUE.SNS/ch1/front# npm run build

 

> vue-nodebird-front@1.0.0 build /home/ubuntu/VUE.SNS/ch1/front

> nuxt build

 

sh: 1: nuxt: Permission denied

npm ERR! code ELIFECYCLE

npm ERR! errno 126

npm ERR! vue-nodebird-front@1.0.0 build: `nuxt build`

npm ERR! Exit status 126

npm ERR!

npm ERR! Failed at the vue-nodebird-front@1.0.0 build script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

npm ERR! A complete log of this run can be found in:

npm ERR!     /root/.npm/_logs/2021-09-23T05_51_51_872Z-debug.log

root@ip-172-31-30-117:/home/ubuntu/VUE.SNS/ch1/front#

프론트의 노드 모듈을 재설치해보고 git pull로 서버에서 받아서 sudo npm i이후에  run build를 해도 같은 현상이 나타납니다 ㅜ

한 번 sudo 쓰시면 전부 다 sudo로 하셔야 합니다. sudo랑 sudo없는 것과 섞어쓰면 문제가 생길 수 있습니다.

그리고 저 메모리 에러는 결국 인스턴스를 더 큰 걸로 변경하는 수밖에 없을 것 같습니다. 이 때는 무료가 아니게 되니 주의하세요.

문종현님의 프로필

문종현

질문자

2021.09.23

아 해결했습니다!!

그냥 바로 위 질문했던 상태에서 npm i nuxt 이후에 npm run build 하니까 빌드가 잘 됩니다!!! 우아!!!!!! 드뎌!! 6-6강의의 구렁텅이에서 탈출했습니다... 인스턴스도 계속 다시 만들어보고 별거 다해봤는데..  정말 감사합니다 제로초님!!! 정말 큰 도움 됬습니다!! 감사합니다^^