I installed Atom and Nuclide and opened a newly initialized React Native Project in Atom. Once I try to start the React Native Packager I am getting an error stating
An unexpected error occurred while running the React Native Packager process:
ENOTDIR: not a directory, stat '/Users/UserName/Documents/MyProjectDirectory/ProjectName/package.json/package.json'
There is no directory called package.json and I'm not aware how this path could have become corrupted. Any help would be much appreciated.
Not a solution, but a workaround for now:
You can run the following to start the packager manually: npm start
Or, generally, running react-native run-ios (or run-android) will start the packager as a matter of course (in a separate terminal window).
(Also no clue why this is happening; for me, it was after the upgrade from RN 0.49 ~> 0.50.)
Related
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
I just cloned this repository and there is this error.
When I try to run ./gradlew installRelease or npx react-native run-android --variant=release, I get this error because of Hermes. Yes I enabled Hermes on my build.gradle. It works without hermes.
> Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
Loading dependency graph, done.
...
info Done writing sourcemap output
info Done writing bundle output
info Copying 13 asset files
info Done copying assets
> Task :app:bundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> A problem occurred starting process 'command '../../node_modules/hermes-engine/osx-bin/hermes''
I am using macos.
I ran yarn add hermes-engine to make sure this node module exists. I have found many github issues but they are mostly talking about windows.
Just check if you are using windows and if your PC is just a year older, then u have to uninstall visual c++ 2019 redistributable, install visual c++ 2015 redistributable.
if u have linux, then no extra need.
I think this issue is happening because you might have done build 2-3 times.
So my advice is just do cd android & gradlew clean & gradlew assembleRelease.
Can u check your react native version? Hermes only works for react-native >= 0.60.4. Also some modules like react-native-firebase (if you are using in your project), are still not compatible with Hermes.Also if you are building app bundles instead apk, then make sure that react-native version should be 0.62 or more.
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.
I tried building recutils version 1.7 downloaded from the home page, using the standard configure, make, sudo make install sequence, but when trying to run the resulting binaries. like recinf, I get the error:
recinf: error while loading shared libraries: librec.so.1: cannot open shared object file: No such file or directory
Does this mean I made a mistake during the build or is the package itself in error?
As Etan Reisner said the problem was that the shared object libraries were installed but not loaded into the cache, hence the need to run ldconfig. After running
sudo ldconfig
the binaries ran properly. If I had looked in /usr/local/lib, I would have seen the libs there.
I'm using NodeJS under Windows (with node.exe downloaded from NodeJS site). I would like to use this db-mysql extension with it ( https://github.com/mariano/node-db-mysql/ )
I have no idea how to use it. Is it necessary to rebuild the whole node.exe or is it possible to build just the extension? I'm not able to run NPM with node.exe (it results in error) as the installation instructions says.
Thanks
Sorry but you will have to have a full tool-chain(Cygwin) that can compile c. That means you have three alternatives:
Use linux (in a VM) or mac
Install node from cygwin ( https://github.com/joyent/node/wiki/Building-node.js-on-Cygwin-(Windows) )
Use another database (eg. node-dirty: https://github.com/felixge/node-dirty) that doesn't need to be compiled.
You can't use NPM (Node Package Manager) with the Windows executable node.exe as for all I know.
Instead you should download the zip/tar module from https://github.com/mariano/node-db-mysql/downloads and place the contents into a *node_modules* folder above your script(s).
Example structure:
/nodestuff
/node_modules
/db-mysql // The module
/script
app.js // Your script
Then just follow the instructions on https://github.com/mariano/node-db-mysql/ in order to create a database connection.
Good luck.