Closed Ayato-kosaka closed 1 year ago
以下の手順でやると npm build が出来ない
gitpod /workspace/spelieve-backend-place (main) $ git clone https://github.com/Ayato-kosaka/spelieve-secret.git
Cloning into 'spelieve-secret'...
remote: Enumerating objects: 71, done.
remote: Counting objects: 100% (71/71), done.
remote: Compressing objects: 100% (61/61), done.
remote: Total 71 (delta 25), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (71/71), 19.09 KiB | 2.73 MiB/s, done.
Resolving deltas: 100% (25/25), done.
gitpod /workspace/spelieve-backend-place (main) $ mv ./spelieve-secret/spelieve-backend/release/.env ./
gitpod /workspace/spelieve-backend-place (main) $ docker build -t place
"docker build" requires exactly 1 argument.
See 'docker build --help'.
Usage: docker build [OPTIONS] PATH | URL | -
Build an image from a Dockerfile
gitpod /workspace/spelieve-backend-place (main) $ docker build -t place .
Sending build context to Docker daemon 1.413MB
Step 1/16 : FROM node:16 AS builder
16: Pulling from library/node
620af4e91dbf: Pull complete
fae29f309a72: Pull complete
28fca74d99b6: Pull complete
0b5db87f5b42: Pull complete
fa488706ea13: Pull complete
0380b9b3282f: Pull complete
383dfecd3687: Pull complete
ca59981dc274: Pull complete
4fa5c4b55a85: Pull complete
Digest: sha256:7f404d09ceb780c51f4fac7592c46b8f21211474aacce25389eb0df06aaa7472
Status: Downloaded newer image for node:16
---> 993a4cf9c1e8
Step 2/16 : ENV NODE_ENV=development
---> Running in 6bc22a2f5365
Removing intermediate container 6bc22a2f5365
---> 81aefe6257d6
Step 3/16 : WORKDIR /app
---> Running in 3302111b6859
Removing intermediate container 3302111b6859
---> 8205a11f291e
Step 4/16 : COPY package*.json ./
---> 2ce5bf4b5691
Step 5/16 : RUN npm install
---> Running in 6853644c617b
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
npm WARN deprecated formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm WARN deprecated superagent@6.1.0: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at <https://github.com/visionmedia/superagent/releases>.
npm WARN deprecated @types/helmet@4.0.0: This is a stub types definition. helmet provides its own type definitions, so you do not need this installed.
npm WARN deprecated superagent@8.0.2: Please use v8.0.0 until https://github.com/visionmedia/superagent/issues/1743 is resolved
added 1497 packages, and audited 1498 packages in 24s
147 packages are looking for funding
run `npm fund` for details
2 high severity vulnerabilities
To address all issues, run:
npm audit fix
Run `npm audit` for details.
npm notice
npm notice New major version of npm available! 8.19.2 -> 9.2.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.2.0>
npm notice Run `npm install -g npm@9.2.0` to update!
npm notice
Removing intermediate container 6853644c617b
---> 5122b7156217
Step 6/16 : COPY . .
---> 9a6aac5d7576
Step 7/16 : RUN npm run build
---> Running in 53e19b0cef03
> spelieve-backend-place@0.0.1 prebuild
> rimraf dist
> spelieve-backend-place@0.0.1 build
> nest build
Removing intermediate container 53e19b0cef03
---> 300647bb7160
Step 8/16 : FROM node:16-stretch-slim AS runner
16-stretch-slim: Pulling from library/node
bff3e048017e: Pull complete
126dbb4e8fc0: Pull complete
2daf78eeb282: Pull complete
1dc472aca539: Pull complete
150bc8d386a3: Pull complete
Digest: sha256:afef4a8000f747fdb0b22479fb4c7a2a19cd6f05b0e08c9f67e430853152c7fc
Status: Downloaded newer image for node:16-stretch-slim
---> d53b6cbca523
Step 9/16 : ARG NODE_ENV=production
---> Running in f7f6ff729fe1
Removing intermediate container f7f6ff729fe1
---> 2e79d177039e
Step 10/16 : ENV NODE_ENV=${NODE_ENV}
---> Running in ee3d74cf9c85
Removing intermediate container ee3d74cf9c85
---> d4597ce981fc
Step 11/16 : WORKDIR /app
---> Running in 15757c333454
Removing intermediate container 15757c333454
---> 049c6cc75916
Step 12/16 : COPY package*.json ./
---> 0103ef1811e0
Step 13/16 : COPY .env ./
---> 07b7c897b16e
Step 14/16 : RUN npm install --omit=dev
---> Running in 08c5e5b05c63
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm WARN deprecated uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
npm WARN deprecated superagent@6.1.0: Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at <https://github.com/visionmedia/superagent/releases>.
added 974 packages, and audited 975 packages in 22s
51 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
npm notice
npm notice New major version of npm available! 8.11.0 -> 9.2.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.2.0>
npm notice Run `npm install -g npm@9.2.0` to update!
npm notice
Removing intermediate container 08c5e5b05c63
---> f243cac6c1b1
Step 15/16 : COPY --from=builder /app/dist ./dist
---> 5ecb77b499df
Step 16/16 : CMD ["npm", "run", "start:prod"]
---> Running in ef025bf97995
Removing intermediate container ef025bf97995
---> 5d11610b42a0
Successfully built 5d11610b42a0
Successfully tagged place:latest
gitpod /workspace/spelieve-backend-place (main) $ docker run --it place
unknown flag: --it
See 'docker run --help'.
gitpod /workspace/spelieve-backend-place (main) $ docker run -it place
> spelieve-backend-place@0.0.1 start:prod
> node dist/main
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '/app/dist/main'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
gitpod /workspace/spelieve-backend-place (main) $ docker run -it place /bin/bash
root@bf96e4011289:/app# ls
dist node_modules package-lock.json package.json
root@bf96e4011289:/app# ls -a
. .. .env dist node_modules package-lock.json package.json
root@bf96e4011289:/app# ls ./dist
spelieve-secret src tsconfig.build.tsbuildinfo
root@bf96e4011289:/app# exit
exit
gitpod /workspace/spelieve-backend-place (main) $ npm run build
> spelieve-backend-place@0.0.1 prebuild
> rimraf dist
sh: 1: rimraf: not found
gitpod /workspace/spelieve-backend-place (main) $ npm install
npm WARN deprecated @types/helmet@4.0.0: This is a stub types definition. helmet provides its own type definitions, so you do not need this installed.
npm WARN deprecated uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
npm WARN deprecated superagent@8.0.2: Please use v8.0.0 until https://github.com/visionmedia/superagent/issues/1743 is resolved
changed 794 packages, and audited 1498 packages in 21s
147 packages are looking for funding
run `npm fund` for details
2 high severity vulnerabilities
To address all issues, run:
npm audit fix
Run `npm audit` for details.
gitpod /workspace/spelieve-backend-place (main) $ npm run build
> spelieve-backend-place@0.0.1 prebuild
> rimraf dist
> spelieve-backend-place@0.0.1 build
> nest build
/workspace/spelieve-backend-place/node_modules/chardet/index.js:13
new utf8,
^
TypeError: utf8 is not a constructor
at Object.<anonymous> (/workspace/spelieve-backend-place/node_modules/chardet/index.js:13:3)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Module.require (node:internal/modules/cjs/loader:1057:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/workspace/spelieve-backend-place/node_modules/external-editor/main/index.js:9:17)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
gitpod /workspace/spelieve-backend-place (main) $ npm run build
@Takapy1 spelieve-secret がいるとバグるみたい!
npm build は成功した!deploy は失敗するけど 52b7791617149076c518df8f5c437135ff255ee1
@Takapy1 ついに成功した!!!!
@Ayato-kosaka 天才!たなみに原因はなんだった?
@Takapy1
https://github.com/Ayato-kosaka/spelieve-backend-place/issues/17#issuecomment-1342830605
Spelieve-secretがディレクトリ内にあったらあかんみたい マジで謎
↑.env を追加で解消