Skip to content
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

TransformError: ENOENT no such file or directory .babelrc with precompiled npm module #7906

Closed
felixmc opened this issue Jun 3, 2016 · 8 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@felixmc
Copy link

felixmc commented Jun 3, 2016

I have a personal npm module, written in es6. It has a prepublish hook that babel transpiles it to es5. In package.json the main field points to the compiled version. .babelrc and es6 src/ are added to .npmignore. So to anyone installing the npm module, the fact that the module is written in es6 should be "invisible". This holds true when installing the module in regular react/webpack builds for both browser and electron.

However, when installing the module in my react native app, I get an error along the lines of: TransformError: ENOENT no such file or directory .babelrc

Here is a screenshot of the full error: https://www.dropbox.com/s/5lwe5fyf44emh6l/Screenshot%202016-06-03%2000.43.53.png?dl=0

The npm module can be found here: https://github.com/felixmc/redux-actions-magic
Feel free to try it for yourself.

I can't seem to find many other running into this issue..If I include the .babelrc in the module, I get a series of other errors (couldn't find X preset, etc). Other issues on here seem to suggest that .babelrc should be avoided in npm packages anyway for that very reason.

I guess don't understand why react-native would even be looking for a .babelrc. The module only has babel as a dev dependency.

Here are my versions of things:
node: 6.2.0
react-native-cli: 0.2.0
react-native: 0.26.3

The error happens in both the android and ios emulators. My dev environment is OS X.

@fab1an
Copy link

fab1an commented Jun 3, 2016

This is probably related to this issue: #7850

@mschipperheyn
Copy link

I have this problem also on a module that doesn't use .babelrc anymore. It just strikes me that these issues come out of nowhere. Seems to have worked before and now completely stuck.

@fab1an
Copy link

fab1an commented Jun 28, 2016

@mschipperheyn Try resetting the packager's cache:

./node_modules/react-native/packager/packager.sh start --reset-cache

Also bear in mind that react-native's transform picks up .babelrc in parent-directories like your home-folder as well.

@chengmu
Copy link

chengmu commented Aug 2, 2016

@fab1an this really works! save my day ! thx~

@fab1an
Copy link

fab1an commented Oct 24, 2016

@chengmu Can you close this?

@patrick91
Copy link

I confirm that this works!

@hramos
Copy link
Contributor

hramos commented May 25, 2017

Closing this issue because it has been inactive for a while. If you think it should still be opened let us know why.

@hramos hramos closed this as completed May 25, 2017
@hramos hramos added the Icebox label May 26, 2017
@mluedke2
Copy link

This helped for me, except that now I found the packager script here: ./node_modules/react-native/scripts/packager.sh start --reset-cache. Looks like it was moved in this commit

@facebook facebook locked as resolved and limited conversation to collaborators Jul 19, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

8 participants