question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"babel: command not found". Babel is not available when installed locally

See original GitHub issue

babel is not available when installed locally. Error thrown:

$ babel react-server.js --out-file react-server-c.js
sh.exe": babel: command not found

I want to compile React components. I follow this setup https://babeljs.io/docs/setup/#babel_cli. It says:

While you can install Babel CLI globally on your machine, it’s much better to install it locally project by project.

Ok. I uninstall global babel:

npm uninstall --global babel-cli

And install babel locally in my app:

npm install --save-dev babel-cli

Now I have it in my app’s package.json file:

  "devDependencies": {
    "gulp": "^3.9.0",
    "babel-cli": "^6.3.17"
  }

And now I do as tutorial says, I run babel to compile my file and get an error that babel is not found:

$ babel react-server.js --out-file react-server-c.js
sh.exe": babel: command not found

My system: “babel-cli”: “^6.3.17”, window 8.1 npm 2.5.1 node v0.12.0

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
wzupcommented, Dec 16, 2015

What if I don’t want to use npm scripts and want to use plain vanilla cli? Should be covered in docs.

2reactions
hzoocommented, Jun 20, 2017

Yeah if you uninstall it globally then there won’t be a direct alias to babel without using ./node_modules/.bin/babel or using babel as a npm script.

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm - Babel command not found - Stack Overflow
There are two problems here. First, you need a package.json file. Telling npm to install without one will throw the npm WARN enoent...
Read more >
babel: command not found error [Solved] | bobbyhadz
Use npx to solve the error "babel: command not found", e.g. npx --package @babel/cli babel --version or install the package globally by running...
Read more >
Babel CLI
While you can install Babel CLI globally on your machine, it's much better to install it locally project by project. There are two...
Read more >
i could not set up babel-cli package globally installed via yarn?
js, and more but I could not get it done. I installed babel-cli locally yet I got same error: bash: babel: command not...
Read more >
[Solved]-Babel command not found-babel.js - appsloveworld
There are two problems here. First, you need a package.json file. Telling npm to install without one will throw the npm WARN enoent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found