NodeJS 在将mern网站部署到railway时出现错误

mzillmmw  于 2023-01-08  发布在  Node.js
关注(0)|答案(1)|浏览(171)

我在https://github.com/Inferno-Ripper/discord-clone有一个不和谐的克隆组合项目我已经部署了前端到vercel https://inferno-ripper-discord-clone.vercel.app,它在firefox上工作正常,但在chrome和edge上不工作网络请求被挂起。我有后端托管在railway上,但当我尝试部署前端到railway时它不工作我得到这个错误
在铁路上建造原木

==============
        Using Nixpacks
        ==============
        Inline cache enabled
        no image tag to read cache from
        
        ╔═════════ Nixpacks v1.0.0 ═════════╗
        ║ setup      │ nodejs-16_x, npm-8_x ║
        ║───────────────────────────────────║
        ║ install    │ npm ci               ║
        ║───────────────────────────────────║
        ║ build      │ npm run build        ║
        ║───────────────────────────────────║
        ║ start      │ npm run start        ║
        ╚═══════════════════════════════════╝
        
        
        #1 [internal] load build definition from Dockerfile
        #1 sha256:8877270a0c7cc13a2a9d5d8d7622cdc0ed73b70ab957d081f5d2851376bd3d8b
        
        #1 transferring dockerfile: 2.08kB done
        #1 DONE 0.1s
        
        #2 [internal] load .dockerignore
        #2 sha256:2affaad88737ba21b452b724bb2eb7f99ebe9375f3ecc65cb617a265f26c24d8
        #2 transferring context:
        
        #2 transferring context: 2B done
        #2 DONE 0.2s
        
        #3 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1671044363
        #3 sha256:d2df4677b7c4c8365aa628f14d4cbdd9867466b6b454c21060180de4b7936a2e
        
        #3 DONE 0.2s
        
        #4 [stage-0  1/10] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1671044363@sha256:4df36f942799b8b727c8648ca4fa05d9cd2526e41e7994665082c0f7ef03d95b
        #4 sha256:a20b8f1ac783d9d00f7c673a9ef0cf3b8f0aaee89856a86f7aff78cda1934897
        #4 DONE 0.0s
        
        #5 [stage-0  2/10] WORKDIR /app/
        #5 sha256:46f35bb14209f31cddb6d0e80d42b3ceb58d2f45672a3486e22a069140ac06a3
        #5 CACHED
        
        #6 [internal] load build context
        #6 sha256:5648a1c35d09c4517e30329702fb9cb16d3deaa95854bbf8005030d88d65df40
        
        #6 transferring context: 1.35MB 0.0s done
        #6 DONE 0.1s
        
        #7 [stage-0  3/10] COPY .nixpacks/nixpkgs-ffca9ffaaafb38c8979068cee98b2644bd3f14cb.nix .nixpacks/nixpkgs-ffca9ffaaafb38c8979068cee98b2644bd3f14cb.nix
        #7 sha256:27a0f7b0a4acef0e435ab6d4d2af6e3163455490546099ce36a6ce8090fa6663
        #7 CACHED
        
        #8 [stage-0  4/10] RUN nix-env -if .nixpacks/nixpkgs-ffca9ffaaafb38c8979068cee98b2644bd3f14cb.nix && nix-collect-garbage -d
        #8 sha256:b14288120fda49c3952311baf2b490fed38e5c18b07a41507a8fa40b078b7061
        #8 CACHED
        
        #9 [stage-0  5/10] RUN printf '\nPATH=/app/node_modules/.bin:$PATH' >> /root/.profile
        #9 sha256:12dcf6a42bf1344db5b7a02483f2b846eaf2f6bd1e5f24337f79a8189bc2ff93
        
        #9 DONE 0.4s
        
        
        #10 [stage-0  6/10] COPY . /app/.
        #10 sha256:ce0a407cd50a1ccbe3be23e8717eb5b1978e54736f3716257765a0c50bc6ff1f
        #10 DONE 0.1s
        
        
        #11 [stage-0  7/10] RUN --mount=type=cache,id=s/b947d48a-6811-4bd7-be53-d870d96fde71-/root/npm,target=/root/.npm npm ci
        #11 sha256:292fe72abf96a75827c016a9bb758e94e0a7fc5724f193e1c1830ac7b3ac5920
        
        #11 0.730 npm WARN config
        production Use `--omit=dev` instead.
        
        #11 1.915 npm ERR! code ERESOLVE
        
        #11 1.919 npm ERR! ERESOLVE could not resolve
        #11 1.919 npm ERR!
yyyllmsg

yyyllmsg1#

这是一个cors错误,只需要添加这些cookie选项。

{
        httpOnly: true,
        secure: true,
        sameSite: 'none',
}

相关问题