When I'm trying to start a new react-native project from scratch I'm getting this message.
/Users/jorgevenegas/Dev/Projects/testreact/List/node_modules/react-native/node_modules/babel-core/lib/transformation/file/options/option-manager.js:327
throw new Error("Couldn't find preset " + JSON.stringify(val) + " relative to directory " + JSON.stringify(dirname));
^
Error: Couldn't find preset "es2015" relative to directory "/Users/jorgevenegas/Dev/Projects"
I have installed react-native-cli, of course. Using node v4.2.1, react-native 0.1.5, watchman and flow installed too.
Seems to be something related to babel. I can't figure out the reason, though.
I'm attaching a screenshot with a more detailed output.
Thanks in the advance!
This bugged me for a good 1 day. The issue was I had a .babelrc file up in my file hierarchy which was interfering with babel parsing. Got rid of that and it was fine. react-native uses es2015 by default so .babelrc is not required.
Try installing the following packages
npm install babel-preset-es2015 --save
npm install babel-preset-react --save
I had the same problem.
The solution for me was to switch from 'workspace/MyProject' (for you its "/Users/jorgevenegas/Dev/Projects" i guess) to 'workspace'.
I don't know why I had to do this, but when i ran
npm install babel-preset-es2015
npm install babel-preset-react
in my workspace instead, i could cd into 'MyProject' again and execute a react-native run-android from there.
Hope that helps at least some people encountering the same problem.
Add the following line to your .babelrc file:
{"presets": ["react"]}
I find solution from babel.io
I went through something similar, maybe this can help. In my case it was because for some reason I had two instances of react-native installed on my system.
Check the output of
which -a react-native
If you get more than one path with react native installed, get rid of the one that gives you the same error when executing init directly with the full path (my case was one installed at /usr/local/bin/react-native, but yours could be slightly different).
After removing the wrong one, you should be able to init projects without any problems.
Related
I am trying to install sass and I don't understand why I keep running into the issue shown below
I understand I should follow the instructions and run npm audit fix but when I run the command, I get an error of no package.json found, and yes, that is so because sass wasn't installed at all and thus no node-modules and the json file, how do I fix this issue?
Try running the npm init command at the root of your project to generate the package.json file and re run the command to install sass.
In my app.json folder, I have everything bundled nicely, but I have one undefined package at the bottom of the install list:
"undefined": "react-navigation/bottom-tabs"
I tried running an "npm install react-navigation/bottom-tabs" but it threw this error:
warn Package undefined has been ignored because it contains invalid configuration. Reason: Cannot find module 'undefined/package.json'
Has anyone encountered an issue like this before? I am running React-Native Version 5 on top of Expo.
EDIT: It turns out that it was supposed to be #react-navigation/bottom-tabs, so I installed that and made an adjustment; but now I am still stuck with the original undefined package in my app.json folder, and cannot get rid of it.
So, I forgot this post existed and I actually figured this out months ago. When you're dealing with:
A bad bundle,
the wrong version,
or there's just something wrong with your 'package.json' file, (the file that contains the list of your packages)
These steps should fix it:
Perform "npm uninstall 'package-name' " or "yarn remove 'package-name'"
Note: You do this instead of 'expo-uninstall' because 'expo-uninstall' does not exist. We use 'expo-install' instead of 'npm' or 'yarn' install to make sure you download the proper npm or yarn version associated with your version of expo.
Open the package.json file and see if the bad package you uninstalled is still present.
If the bad package is still there, select and delete it from the file, then save.
Run an "expo" "npm" or "yarn" install on the correct package name
This should fix it. This is best fixed when step 4 is executed with an 'expo install' as you likely have an incompatible version of the package, so this will prevent that from happening again.
In my case, I couldn't figure out why my terminal was telling me a specific package didn't exist, so I did a "sud" command to force download the package. This package didn't exist, because I had actually spelled it wrong.
try deleting your node modules and install them again and make sure your metro is closed
clear cache and you are good to go by the way it worked for me
npm install or yarn add
npm start --reset-cache
This is my first attempt at using a frontend package that uses Grunt/Bower.
I am specifically referring to a Wrapbootstrap theme.
I followed the instructions as follows:
npm install -g grunt-cli
npm install -g bower
npm install
bower install
I believe the process went fine. There were some deprecation warnings though.
What I ended up was with a file structure like this:
However, now I am lost as how to start.
The instructions says to do grunt live but it just opens up a blank page without anything on it. I opened every index.html in there but no luck.
Would really appreciate if you someone can set me on a path to realizing how to deal with the Grunt/Bower tools and how to troubleshoot this case.
Thank you.
I'm having trouble with electron-compile.
The docs state
How does it work? (Easiest Way)
Change your reference to electron-prebuilt to electron-prebuilt-compile. Tada! You did it.
What reference, where? You can't be talking about package.json?
I've always run electron using supervisor -x "electron" -i "./" .
What am I completely missing / what should be the contents of my pull request to make this clearer?
I've installed electron-compile with npm i electron-compile --save-dev
I'd like to have es2015/jsx precompiled to es5, so that I can run a react application in electron. electron-compile appears to solve this problem.
You should install Electron as a dev reference in package.json, yes:
npm install --save-dev electron-prebuilt-compile
Don't install Electron as a global because then other people have to set stuff up to run your app (i.e. they now have to micromanage which version of Electron they have installed globally)
With the recent versions (electron 1.3.5), I was unable to get electron-prebuilt-compile working, well it works for development but packaging for production has no real working examples.
It seems the compiling and packaging needs to be done manually, so in case anyone needs a working example, it's here. Hope to save someone some time and pain.
Please I need to understand what I must do to take care of this problem
"[Error: Can't find npm module 'react/package.json'. Did you forget to call 'Npm.depends' in package.js within the 'modules-runtime' package?]" I kept having as I try to develop app in meteor with react.
I really do not know what triggers the error.
Thanks for your anticipated assistance.
You will need to install react and react-addons-pure-render-mixin.
npm install --save react react-addons-pure-render-mixin
I was having the same issue from react-meteor-data package when I tried to start my app.
https://atmospherejs.com/meteor/react-meteor-data