-
Notifications
You must be signed in to change notification settings - Fork 91
Description
As noted in the Readme:
The cartridge emulates the execution of npm start to start your application, so make sure your application
entrypoint is defined in your start script of your package.json file. See package.json in the provided
template or read the npm docs for more information.
Some advantages of using npm
directly would include:
- automatically add
node_modules/.bin
to$PATH
:
In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to
scripts. Any binaries provided by locally-installed dependencies can be used without the
node_modules/.bin prefix.
With the assumption that this emulation was meant to be similar to the actual npm start
, the start command (in bin/control#L6
),
START_COMMAND=$(node -e "var p = require('$OPENSHIFT_REPO_DIR/package.json'); console.log(p.scripts.start);")
could be enhanced to run npm:
START_COMMAND="npm start"
Since this command will be executed in the repository's working directory, we can be sure it will find a package.json
to look for the scripts in.
Side note:
- I noticed this when I tried to run
forever app.js
, but the application crashed as theforever
command could not be found ($PATH
did not includenode_modules/.bin
)