Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fix: npm run-script fails silently. closes #2959 #2960

Closed
wants to merge 1 commit into from

4 participants

@andrewrk

No description provided.

@andrewrk

Not really sure where to put this check. My eyes glazed over a bit when I tried to figure out where the script is actually run.

@domenic
Collaborator

+1, @isaacs look good?

@mfncooper
Collaborator

A full stack-trace-style error seems overly drastic to me. I think just showing a simple error message would be a cleaner way of dealing with this. Like this:

if (!pkg.scripts[cmd]) {
  log.error("run-script", "missing script: " + cmd)
  return cb()
}
@othiym23
Owner

We've gone back and forth on this one a number of times, and at this point this PR is hopelessly stale. Sorry we let it get so long in the tooth, and if the current behavior is still not to your liking, open a new PR and we can try this again.

@othiym23 othiym23 closed this
@andrewrk

can you just fix it? as I've demonstrated it's a simple fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 25, 2012
  1. @andrewrk
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/run-script.js
View
4 lib/run-script.js
@@ -86,6 +86,10 @@ function run (pkg, wd, cmd, cb) {
,"restart"
,"prestart","start","poststart"]
} else {
+ if (!pkg.scripts[cmd]) {
+ cb(new Error("missing script: " + cmd));
+ return;
+ }
cmds = [cmd]
}
if (!cmd.match(/^(pre|post)/)) {
Something went wrong with that request. Please try again.