1

I am new to using railway, but I have a MERN full-stack app, and I am migrating it from Heroku to railway. I inserted my environment variables to railway from my .env file (such as my MONGODB_URI, API_KEYs, PORT, exc.)

the current project file structure is as follows:

client
 |
  -build
node_modules
server
 |
  -server.js
.env
.gitignore
package-lock.json
package.json
Procfile
README.md

Here is a screenshot for better illustration:

enter image description here

In my Procfile it has the following script:

web: npm run start

Here is the list of scripts for my package.json (root level):

 "scripts": {
    "start": "node server/server.js",
    "develop": "concurrently \"cd server && npm run watch\" \"cd client && npm start\"",
    "install": "cd server && npm i && cd ../client && npm i ",
    "seed": "cd server && cd config && node seeds.js",
    "build": "cd client && npm install && npm run build"
  }

Here is what I tried:

  • I went to Settings in railway and added a custom build command as the one in my package.json:

enter image description here

  • I tried deploying without a Procfile as well.
  • I tried adding a custom script command to railway (the same as the one in my package.json)

I still get a build error showing the following:

#11 1.731 npm ERR! code EUSAGE
 
#11 1.735 npm ERR!
#11 1.735 npm ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
#11 1.735 npm ERR!
#11 1.735 npm ERR! Missing: react@18.2.0 from lock file
#11 1.735 npm ERR! Missing: loose-envify@1.4.0 from lock file
#11 1.735 npm ERR! Missing: js-tokens@4.0.0 from lock file
#11 1.735 npm ERR!
#11 1.735 npm ERR! Clean install a project
#11 1.735 npm ERR!
#11 1.735 npm ERR! Usage:
#11 1.735 npm ERR! npm ci
#11 1.735 npm ERR!
#11 1.735 npm ERR! Options:
#11 1.735 npm ERR! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
#11 1.735 npm ERR! [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling]
#11 1.735 npm ERR! [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
#11 1.735 npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
#11 1.735 npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
#11 1.735 npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
#11 1.735 npm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links]
#11 1.735 npm ERR!
#11 1.736 npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
#11 1.736 npm ERR!
#11 1.736 npm ERR! Run "npm help ci" for more info
#11 1.737
#11 1.737 npm ERR! A complete log of this run can be found in:
#11 1.737 npm ERR!     /root/.npm/_logs/2023-01-12T00_02_06_608Z-debug-0.log
 
#11 ERROR: executor failed running [/bin/bash -ol pipefail -c npm ci]: exit code: 1
-----
> [stage-0  7/10] RUN --mount=type=cache,id=s/0a73518e-f9d9-405d-83da-4e03db5e343a-/root/npm,target=/root/.npm npm ci:
-----
executor failed running [/bin/bash -ol pipefail -c npm ci]: exit code: 1
 
Error: Docker build failed
paul
  • 41
  • 3

0 Answers0