Reputation: 43
I've just installed the babel-cli
module locally to my project but when I run babel test.js
in the terminal it outputs that the *command babel is uknown*
.
What I figured out is that npm
is trying to find the module in my globally installed modules instead of my project modules, how can I fix it?
Sorry for the silly question but I'm not finding a solution.
Upvotes: 0
Views: 797
Reputation: 5871
You can either
Use the babel installed in you project - node_modules/.bin/babel test.js
Add a script in your package.json
and run it via npm - npm run <script_name>
. npm
will use the version of babel installed in your project
Upvotes: 1
Reputation: 5018
When you run babel. It looks for global npm directory and can't find it there.
2 ways but one is redundant.
There is a discussion on that. And here is a good article. http://www.joezimjs.com/javascript/no-more-global-npm-packages/
Upvotes: 0