"babel: command not found". Babel is not available when installed locally
See original GitHub issuebabel
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:
- Created 8 years ago
- Comments:8 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What if I don’t want to use
npm scripts
and want to use plain vanilla cli? Should be covered in docs.Yeah if you uninstall it globally then there won’t be a direct alias to
babel
without using./node_modules/.bin/babel
or usingbabel
as a npm script.