Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2011-10-15 01:04:56 +0400
committerisaacs <i@izs.me>2011-10-15 01:06:12 +0400
commit4eb8f6b7bfced57ce8415e98a632af5c5317011c (patch)
tree68ae609781fc65140b5e6f36f62abf8159ebc5ef /bin
parentf2b9b5dd5b02625cf26c2050916a422650ce3e99 (diff)
Avoid accidentally opening npm.js with WSH
Diffstat (limited to 'bin')
-rwxr-xr-xbin/npm-cli.js (renamed from bin/npm.js)22
-rw-r--r--bin/npm.cmd1
2 files changed, 17 insertions, 6 deletions
diff --git a/bin/npm.js b/bin/npm-cli.js
index 003c3f953..db6db2fbd 100755
--- a/bin/npm.js
+++ b/bin/npm-cli.js
@@ -1,16 +1,28 @@
#!/usr/bin/env node
;(function () { // wrapper in case we're in module_context mode
-var log = require("../lib/utils/log")
+
+// windows: running "npm blah" in this folder will invoke WSH, not node.
+if (typeof WScript !== "undefined") {
+ WScript.echo("npm does not work when run\n"
+ +"with the Windows Scripting Host\n\n"
+ +"'cd' to a different directory,\n"
+ +"or type 'npm.cmd <args>',\n"
+ +"or type 'node npm <args>'.")
+ WScript.quit(1)
+ return
+}
+
+var log = require("../lib/utils/log.js")
log.waitForConfig()
log.info("ok", "it worked if it ends with")
var fs = require("graceful-fs")
, path = require("path")
- , npm = require("../npm")
- , ini = require("../lib/utils/ini")
- , errorHandler = require("../lib/utils/error-handler")
+ , npm = require("../lib/npm.js")
+ , ini = require("../lib/utils/ini.js")
+ , errorHandler = require("../lib/utils/error-handler.js")
- , configDefs = require("../lib/utils/config-defs")
+ , configDefs = require("../lib/utils/config-defs.js")
, shorthands = configDefs.shorthands
, types = configDefs.types
, nopt = require("nopt")
diff --git a/bin/npm.cmd b/bin/npm.cmd
deleted file mode 100644
index 387fc26fa..000000000
--- a/bin/npm.cmd
+++ /dev/null
@@ -1 +0,0 @@
-@node %~dp0\..\npm.js %*