happypoulp / redux-tutorial

Learn how to use redux step by step
3.76k stars 546 forks source link

added directions to assure babel-cli is installed #58

Closed joeeames closed 8 years ago

joeeames commented 8 years ago

In case someone running the tutorial hasn't yet installed babel-cli.

happypoulp commented 8 years ago

Hi,

I am not sure this is needed since babel-node is currently specified in package.json.

After running npm install, you shouldn't need anything more to run the examples. Did you had trouble with what was installed by npm install (wasn't it enough to run npm run example <example.js>)?

joeeames commented 8 years ago

No. Babel-node must be installed globally otherwise the command fails because it's not in the global path.

This was true on my box and as far as I know true always. Any command besides "node" from the cli would require a global install or else a reference into the path in node_modules....

I'm on holiday and not where I can do much testing or research. Can you run it on a box with no Babel cli installed globally? I couldn't.

On Fri, Oct 30, 2015, 6:52 PM François Bonnefont notifications@github.com wrote:

Hi,

I am not sure this is needed since babel-node is currently specified in package.json.

After running npm install, you shouldn't need anything more to run the examples. Did you had trouble with what was installed by npm install (wasn't it enough to run npm run example )?

— Reply to this email directly or view it on GitHub https://github.com/happypoulp/redux-tutorial/pull/58#issuecomment-152615671 .

joeeames commented 8 years ago

Isn't this why projects that use gulp remind you to install it globally?

On Wed, Nov 4, 2015, 12:37 PM Joe Eames joeeames@gmail.com wrote:

No. Babel-node must be installed globally otherwise the command fails because it's not in the global path.

This was true on my box and as far as I know true always. Any command besides "node" from the cli would require a global install or else a reference into the path in node_modules....

I'm on holiday and not where I can do much testing or research. Can you run it on a box with no Babel cli installed globally? I couldn't.

On Fri, Oct 30, 2015, 6:52 PM François Bonnefont notifications@github.com wrote:

Hi,

I am not sure this is needed since babel-node is currently specified in package.json.

After running npm install, you shouldn't need anything more to run the examples. Did you had trouble with what was installed by npm install (wasn't it enough to run npm run example )?

— Reply to this email directly or view it on GitHub https://github.com/happypoulp/redux-tutorial/pull/58#issuecomment-152615671 .

happypoulp commented 8 years ago

No. Babel-node must be installed globally otherwise the command fails because it's not in the global path.

On my environment, I did not installed babel-node globally and npm run example <example.js> is running correctly.

This was true on my box and as far as I know true always. Any command besides "node" from the cli would require a global install or else a reference into the path in node_modules....

When you run a command through npm run, npm automatically search for executable located inside node_module/.bin. Since babel-node is installed via the package.json, it is present in node_module/.bin.

See: https://docs.npmjs.com/cli/run-script In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to scripts. Any binaries provided by locally-installed dependencies can be used without the node_modules/.bin prefix

Isn't this why projects that use gulp remind you to install it globally?

I can't say, I don't know much of gulp :).

I'd really like to avoid forcing anyone to install babel-node globally for the tutorial if it's not strictly required. When you will be able to, please confirm that you can run the examples without a globally installed babel-node.

Thanks!

joeeames commented 8 years ago

I can confirm that you are correct, it runs just fine without babel-node installed globally on my computer.

I now realize what I did. I had not followed all instructions, and was trying to diagnose why something wasn't working, and tried babel-node manually from the CLI. I was unaware of this feature of npm run.

You can reject this PR. Sorry for the trouble. Excellent tutorial btw.

On Wed, Nov 4, 2015 at 6:35 PM, François Bonnefont <notifications@github.com

wrote:

No. Babel-node must be installed globally otherwise the command fails because it's not in the global path.

On my environment, I did not installed babel-node globally and npm run example is running correctly.

This was true on my box and as far as I know true always. Any command besides "node" from the cli would require a global install or else a reference into the path in node_modules....

When you run a command through npm run, npm automatically search for executable located inside node_module/.bin. Since babel-node is installed via the package.json, it is present in node_module/.bin.

See: https://docs.npmjs.com/cli/run-script

  • In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to scripts. Any binaries provided by locally-installed dependencies can be used without the node_modules/.bin prefix *

Isn't this why projects that use gulp remind you to install it globally?

I can't say, I don't know much of gulp :).

I'd really like to avoid forcing anyone to install babel-node globally for the tutorial if it's not strictly required. When you will be able to, please confirm that you can run the examples without a globally installed babel-node.

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/happypoulp/redux-tutorial/pull/58#issuecomment-153822929 .

Joe Eames Software Craftsman

joeeames commented 8 years ago

closed because this is unnecessary.