-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't require babel to be installed globally #409
Conversation
CC @yungsters who knows this stuff; I might be unaware of some constraints. |
According to npm-build(1), the My understanding is that if you have a If you take a look at the example's
The
So back to the problem at hand — I don't think that changing Instead, it seems that any package that has a
|
Whoops, I accidentally closed this. I'll fix it up and resubmit. |
While investigating an issue reported for the todomvc example (#408), I found that `npm install` in an example directory was blowing up because I didn't have `babel` installed globally: ``` sh: babel: command not found ``` (Full output at https://gist.github.com/wincent/3221694ee3fdc46084f4) What's happening here: - Example's `preinstall` runs `install` from the top-level. - Top-level `install` installs its babel-relay-plugin dependency from NPM. - Example's `install` runs, and runs `build` from the babel-relay-plugin `file:../` dependency. - Note that `install` hasn't happened inside the `file:../` dependency yet, which means that the `babel` call will blow up if not globally installed. Fix: - Make sure the example's `preinstall` step `cd`'s into the `file:../` dependency and installs its dependencies (ie. `babel`) up front. Known issue: - `&&` won't work on Windows. I could "fix" that by using `;` instead, but the better fix is to turn these into cross-platform node scripts. I'll create a separate issue for that, if I can't find an existing one. Tested: Blow away global babel (`npm uninstall -g babel`), example `node_modules` and top-level `node_modules`, then `npm install` from inside an example or top-level; see it no longer blows up. Also `npm run update-schema` works, as does `npm run start`.
Ok, I think this should be good to go now. @facebook-github-bot import |
Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/1650880361858182/int_phab to review. |
While investigating an issue reported for the todomvc example
(#408), I tried to repro as follows:
But it went boom during the
npm install
because I didn't havebabel
installed globally:
(Full output at https://gist.github.com/wincent/3221694ee3fdc46084f4)
What's happening here:
preinstall
tries to runinstall
from the top-levelinstall
tries to install babel-relay-plugin dependencybuild
step runs and tries to shell out tobabel
babel
call will blow up if not globally installed, even though babelis listed as a dev dependency
Workaround:
Fix employed here: we add
npm install --ignore-scripts
to thebabel-relay-plugin
build
recipe, causing it to become available innode_modules
and therefore the$PATH
when thebabel
command laterruns. Note that without the
--ignore-scripts
we get into an infiniteloop, although I am not sure of the exact chain of cause and effect
because all we see on the console at that point is this, endlessly
repeated:
Also note the use of
;
instead of&&
in the interest of preservingpotential future compatibility with Windows.
I think this change should be ok for end users or the
babel-relay-plugin, as they don't end up running the
build
script andinstead just get whatever we built into
lib/
.Test Plan: Blow away global babel (
npm uninstall -g babel
) and examplenode_modules
and thennpm install
from inside example or top-level,see it no longer blows from.