8000 docs/src/pages/deploy/nodejs.md at main · hmmhmmhm/docs · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 1.26 KB

nodejs.md

File metadata and controls

45 lines (33 loc) · 1.26 KB
title NodeJS Builds

The NodeJS buildpack detects if your build is Node by looking for a package.json file. If found, the build will execute the following NPM (or Yarn) commands.

npm install
npm run build

If no Procfile is found, a web process will be started with npm start .

You can customize the node version using the engines field of your package.json. For example

{
  "engines": {
    "node": ">=0.10.3 <15"
  }
}

Custom Build Command

At the moment, we only support custom build commands wtih the Paketo buildpacks. To specify a custom build script, you can use the BP_NODE_RUN_SCRIPTS environment variable.

The example below will run the lint script followed by the build script.

BP_NODE_RUN_SCRIPTS = lint,build

Sample Node Procfile

Railway uses Procfiles to determine the start command of your application. For NodeJS, it's usually best practice to serve a compiled version of your application and serve the distribution via a start command defined in your package.json

web: npm start
0