update
This worked for me per #digit comment
"dependencies": {
"react": "16.0.0-alpha.12",
"react-native": "0.45.1"
},
"devDependencies": {
"babel-jest": "20.0.3",
"babel-preset-react-native": "2.0.0",
...
},
I followed the instructions for building projects in native code for macos > ios. I ran react-native run-ios and I got the error in the title... Any thoughts? My thoughts are at the end if you want to read it.
Unknown plugin "transform-runtime" specified in "<myprojectdir>/node_modules/regenerator-transform/package.json" at 0, attempted to resolve relative to "<myprojectdir>/node_modules/regenerator-transform" (While processing preset: "<myprojectdir>/node_modules/babel-preset-react-native/index.js")
package.json
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.0.0-alpha.12",
"react-native": "0.46.0"
},
"devDependencies": {
"babel-jest": "20.0.3",
"babel-preset-react-native": "2.1.0",
"jest": "20.0.4",
"react-test-renderer": "16.0.0-alpha.12"
},
"jest": {
"preset": "react-native"
}
my npm & node versions
➜ nativeapp npm -v
4.6.1
➜ nativeapp node -v
v8.1.3
Thank you for looking. Below is my unrelated ranting about my react native but I do genuinely seek some guidance if you have any.
I watched the lectures of coders who works on react-native and I read as much as I can prior to my project and from what I can tell they are all geniuses. I am not being sarcastic I sincerely think that. Yet I fail to understand why my experience with react native is so bad. I mean ... fresh install ... should work? I do not know how many expo projects I have created and moved my stuff around before this because every freakin time I installed a package from npm, everything broke.
I've been a full time coder for 8 years and I've worked projects using things from bash to perl to python to php to golang to mysql to mongo to jquery to angular to vue to vanillajs to ionic to java to C to R yet I do not think I have ever been this frustrated with any new stack I have ever worked on.
What am I missing? What is it that I am doing wrong? Please somebody tell me because I am about to lose my mind and throw my laptop out the window. I spend my time debugging errors instead of making progress in my project. I get up in the morning two hours before work to work on this project and I work on it at home after work... It is 8PM and I've been trying to run the app for two hours now.
I am beginning to think I am the only one with these problems thus I am the cause. I see all these companies using react native and it does not make sense for any company to invest in something that is going to make its developers have the same experience as me. Just spending time on getting it to open.
Sorry about my ranting and please note that I care more about fixing the issue.
I am just passionate about what I do and I do not like spending my hours and not making progress for reasons that I do not expect to have. Thx for looking
According to this link https://github.com/facebook/react-native/issues/14843,
this is a bugs related to the babel-preset-react-native for react native v0.46. For temporary solution
1) Remove .babelrc by doing rm -rf .babelrc inside root folder
2) Revert babel-preset-react-native to the version 2.0.0
Related
I created a React Native Project using React Native CLI then installed expo as mentioned in the documentation here
I used the Automatic Method and ran npx install-expo-modules#latest
After that I ran npx pod-install then npx react-native run-ios
But I am getting the following error after that,
I have the following dependencies,
"expo": "^47.0.0",
"react": "18.2.0",
"react-native": "0.71.1",
What am I doing wrong here?
I had the same issue and I just needed to add a distribution certificate to the MacOS key chain, this person's issue on GitHub gives you a good idea on how to do it: https://github.com/expo/eas-cli/issues/1331. I highly recommend viewing the post by KiwiKilian. You can access it here
After adding the certificate to the keychain, the error just went away for me.
Useful resources
https://support.apple.com/en-au/guide/keychain-access/kyca1083/mac
https://support.magplus.com/hc/en-us/articles/203808748-iOS-Creating-a-Distribution-Certificate-and-p12-File
https://developer.apple.com/forums/thread/662300
https://developer.apple.com/support/expiration/
Hope it helped!!
what could be the best way to package an electron apps.
I have test and run my electron app and it works fine. Now I want to package my electron app but it just shows in command prompt
packaging app for platform win32 ia32 using electron v5.0.6 and nothing else as can be shown in the screenshot below.
when I check electron version via this code electron --version
it output v1.4.13 but during packaging it uses electron v5.0.6. Is this an electron version conflict or what?
here is my package.json
{
"name": "test-app",
"version": "1.0.0",
"description": "",
"main": "main.js",
"dependencies": {
"pretty-bytes": "^2.0.1"
},
"devDependencies": {
"electron": "^5.0.6",
"electron-prebuilt": "^0.35.2"
},
"scripts": {
"start": "electron main.js"
},
"author": "",
"license": "ISC"
}
can someone tell me what is wrong and why my electron app refuse to be packaged.
I found out that the code will eventually compile using electron-packager source Electron Packager. If users is compiling or packaging app for the first time, it can take up 30 minutes or more so the user has to be patient and it will package well. From the screenshot above, you can see that my app is already compiling just that I was impatient to see the end.
Waiting for about 30 minutes allows my system to finally package the app so am good to go now with electron. Thanks
So I made a react-native project that fully works on android now, but when I try to run it on ios I keep getting more problems.
picture
I know this question is already all over stackoverflow and the react-native github page, but all those answers don't seem to work for me and I doubt anyone checks those comments anymore.
I had a similar problem on another project but IIRC that was solved by updating my RN version.
Does anyone know what I did wrong here?
I already tried:
updating RN
downgrading RN
installing #babel/runtime: 7.0.0
installing schedule: 0.4.0
removing all the '^'-characters of the package version
remove node_modules and package-lock.json and reinstalling
...
package.json
"dependencies": {
"#babel/runtime": "7.0.0",
"react": "16.6.0-alpha.8af6728",
"react-native": "0.57.2",
"react-native-fetch-blob": "0.10.8",
"react-native-orientation": "3.1.3",
"react-navigation": "3.0.9"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.47.0",
"react-test-renderer": "16.6.0-alpha.8af6728",
"schedule": "0.4.0"
},
Few things that may guide you in the right direction.
Are you sure you want the dependency on the devDependencies section, instead of dependencies? Development dependencies are for the tooling used for your project, not the project itself. Importing code from devDependencies directly in your application code is a code smell. Also, which may be a case for you, some CI servers may not install devDependencies by default.
There is no tracking file in the 0.4 version of the package. However, there is a tracing.js file. Are you sure you're importing the right file? You can browse all files bundled in the package here.
As the documentation states: "This is a package for cooperative scheduling in a browser environment.". Are you're sure you can use it in React Native?
Last two points don't explain why it works on Android and not on iOS thou.
If you don't need schedule package directly, and you install it only because of the error, then you should remove it from package.json as it shouldn't be there in the first place (remember to remove node_modules / clean cache afterward).
This is an internal React package, and you should not use it directly unless you knew what you are doing. In this case, the root cause of the initial error is probably something different.
When I run my react-native app with Xcode, and after the app starts to load, I see this error:
"Requiring unknown module "react". If you are sure the module is there, try restarting the packager."
My package.json contents are:
{
"name": "the_golf_mentor",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
},
"dependencies": {
"react-native": "^0.21.0",
"react-native-button": "^1.4.2",
"react-native-cookies": "^0.0.5",
"react-native-db-models": "^0.1.3",
"react-native-navbar": "^1.2.1",
"react-native-side-menu": "^0.18.0",
"tcomb-form-native": "^0.3.3"
}
}
I have tried restarting the package manager, and I have also removed the node_module folder and done a fresh npm install. How do I fix this problem?
I had this after enabling hot reloading, and then downgrading my react version to support a library I was using.
Simulator > Reset Content and Settings
Got it running again.
In React Native React lives in react-native module instead of react (for React JS). In that case import React and other React Native modules via:
import React, {
Component,
View,
Text,
// other React Native modules
} from 'react-native';
I encountered the same error. I closed down IDE and restarted, it worked for me. If nothing works out, try npm install
You should require React from react-native in a react-native project, and not from react.
var React = require('react-native');
It turned out that the error message was an interim one I was receiving in the debugger. When I pressed continue a couple of times in the debugger, I received a message in the simulator window which indicated I had not registering the app properly, i.e. my AppRegistry.registerComponent call was invalid.
I suspect this was an unusual cause of the unknown module 'react' error message. In many cases, neciu's answer is probably more useful, so I have also upvoted it as well.
I had similar issue: "Error: Requiring Unknown module 3" after installing '#react-navigation/native', so I did the following to fix it:
Close everything (Metro, Debugger and Simulator)
npm install
npx pod-install ios (On Mac)
npm run ios
and that's it!
I'm looking to use Travis CI. I am erroring out due to failures during npm install. I noticed it can't find file versions marked with ^. This character was added recently. Looking at the build output I noticed:
$ npm --version
1.2.30
My development machine runs npm 2.5.1. I did not see any way to upgrade npm in the Travis CI Settings. I manually changed my package.json to use ~ and that seems to have helped as I got more output:
"devDependencies": {
"jasmine-core": "~2.2.0",
"karma": "~0.12.31",
"karma-chrome-launcher": "~0.1.7",
"karma-cli": "0.0.4",
"karma-jasmine": "~0.3.5",
"karma-requirejs": "~0.2.2",
"requirejs": "~2.1.16"
}
However, I still get errors and these errors also display file version issues and use ^.
How can I get past this?
Add this to your .travis.yml:
before_install:
- "npm install -g npm#'>=2.5.0'"
That resolved my build failure.