diff --git a/packages/babel/package.json b/packages/babel/package.json index a4440b5718f0..4c03e3eb5137 100644 --- a/packages/babel/package.json +++ b/packages/babel/package.json @@ -7,8 +7,8 @@ "license": "MIT", "repository": "https://github.com/babel/babel/tree/master/packages/babel", "bin": { - "babel": "./cli.js", - "babel-node": "./cli.js", - "babel-external-helpers": "./cli.js" + "babel": "./lib/cli.js", + "babel-node": "./lib/cli.js", + "babel-external-helpers": "./lib/cli.js" } } diff --git a/packages/babel/cli.js b/packages/babel/src/cli.js similarity index 58% rename from packages/babel/cli.js rename to packages/babel/src/cli.js index 92c1235cd07d..0a6c889d7d56 100755 --- a/packages/babel/cli.js +++ b/packages/babel/src/cli.js @@ -1,10 +1,13 @@ #!/usr/bin/env node +import path from "path"; + +const globalMessage = path.dirname(process.execPath) === path.dirname(process.env._ || "") ? " -g" : ""; console.error("You have mistakenly installed the `babel` package, which is a no-op in Babel 6.\n" + "Babel's CLI commands have been moved from the `babel` package to the `babel-cli` package.\n" + "\n" + - " npm uninstall babel\n" + - " npm install babel-cli\n" + + " npm uninstall" + globalMessage + " babel\n" + + " npm install --save-dev babel-cli\n" + "\n" + "See http://babeljs.io/docs/usage/cli/ for setup instructions."); process.exit(1);