-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Cannot find module 'warnOnce' from 'react-native-implementation.js' #23943
Comments
Getting the same error when trying to run with versions
Stemming from #22109 so maybe babel issue? |
I have this same issue when running our react-native ios app. |
"Cannot find module 'warnOnce' "error, is there any solution for that. also i dont use pod * React Native Environment Info: my xcode error:: warning: the transform cache was reset.
|
@flodev were u able to solve that issue??? or pass ?? thx |
It is still an issue, have you found a solution? |
This is what I have tried:
That tells me that packager is able to find the warnOnce module. I am not an expert on this, but it sounds like some we maybe using some incompatible library versions? |
@rickhanlonii , i tried your suggestion from other issue page, i still see the error, i know limited people and so many new xcode ticket :( , good luck for all tickets |
Hi @GreenRidingHood, |
@flodev i will try your suggestions, :) about script , anything can happen. While i was trying to run new xcode 10 , so many errors, issues or fixes i go over, i even dont remember :) thx |
Have someone found a fix yet? I am stuck on this |
I'm facing this issue for the past 2 days. Tried many solutions but no result yet |
What is the appropriate version to downgrade to, then? |
I created a new react-native project with a newer version (0.59.4). still facing the same issue |
@sonukj yeah.. i downgraded to 0.58.0 , i dont have that error anymore, but glog , i wonder when i will be able to use xcode10 and react-native without any problem :( |
did you try updating your pod??? |
facing same issue .
any workaround? |
Having the same issue with |
Update: For those Who want to use native features such as AndroidManifest, opening up the project with android studio and/or XCode simply run This is the only solution(s) I've found and I don't mind using it. |
I have resolved this issue, and for me the problem was with |
But from Babel 7 onwards they are not using .babelrc config instead having separate babel.config.js file. Can you tell me reason how the problem solved by changing the configuration? |
@sonukj to make this work in |
@sonukj @amunim solution did not work for me, module.exports = { but still having that error in my xcode
react-native version 0.59.5 still have same issue, ::ffff:127.0.0.1 - - [24/Apr/2019:19:43:46 +0000] "GET /index.ios.bundle?platform=ios&dev=true&minify=false HTTP/1.1" 200 - "-" "myapp/6 CFNetwork/975.0.3 Darwin/17.7.0"
anyway after that RN58 error, i am using 59 again but .. xcode Version 10.1 (10B61) |
Okay, this is somewhat magical, but for me the problem was fixed when I deleted my jest.config.js and moved config to package.json, even despite the contents being identical. |
Didn't work for me... I don't know why |
@empyrical my babel.config.js:
And I'm not using a .babelrc |
@empyrical If I |
I realize by adding module.exports = { presets: ['module:metro-react-native-babel-preset'], }; I can run some command like "babel src/ -d lib/ " without "warnOnce" error. But I have the error if I try to run this command "yarn run metro build index.js -O index.android.bundle" or "yarn android" |
I'm having this same issue when trying to run tests, but instead of jest I'm using mocha (planning on migrating to jest in the future). |
@empyrical Any suggestions? I had to update to 0.60.X to implement the facebook SDK, but I can't do anything now that I've updated because of this issue. I've followed all of the suggestions, but nothing is working and I really need to release the update for my app, but can't until this is resolved so any help would be MUCH appreciated. |
I was fixed this error. I add |
I have no idea why, but for me this problem was solved when I removed this roots config: |
If you have jest.config.js file inside your root directory, so It will look like:
|
I'm having the same issue, |
Why is this issue closed? Still facing the same issue, on different computers. |
Same issue. Any solution ? |
I'm getting same issue for a bunch of things after upgrading to 0.61.0 (from 0.59.10) including To workaround it I've started mocking // From
jest.mock('Platform', () => ({
OS: 'someOS'
}));
// To
jest.mock('react-native', () => ({
Platform: {
OS: 'someOS'
}
})); Still think there's an issue here though as I'm able to reproduce on a fresh React Native project. |
I'm confused. 0.61 is supposed to |
I was using version 0.60.0 and this bug as occurring. |
affects: @natds/mobile Upgraded react native version due to bug on jest execution described here: facebook/react-native#23943
affects: @natds/mobile Upgraded react native version due to bug on jest execution described here: facebook/react-native#23943
I have The Same Issue when i downgrade from 0.61 into 0.60 |
FI : I came across this bug today, and it was because, I was importing a file that imported himeself React while not being in a react environment (but babel-node for a script execution). |
In case someone's still facing this issue using RN < 0.60 (I'm using 0.59.10):
You should now be able to test your components |
I'm using react-native (0.61) in a yarn workspaces monorepo. My fix was to makes sure that jest maps all This can be done by adding a moduleNameMapper rule in module.exports = {
preset: "react-native",
moduleNameMapper: {
"^react-native$": require.resolve("react-native")
}
} |
Thanks @alexander-mozolevsky, this work for me :) |
Changing metro.config.js to this helped meconst blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver: {
blacklistRE: blacklist([
/node_modules\/.*\/node_modules\/react-native\/.*/,
])
},
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
}; |
If you're working with a monorepo and are using components from a common package, try adding this to the
Then get rid of all |
Hello try downgrade nodejs like i did, now im using node 10.20.1 and working good π |
Nothing worked :( |
same here |
π Bug Report
When requiring react-native in node context (e.g. jest) module warnOnce cannot be found.
β Test suite failed to run
To Reproduce
TestFile.js
TestFile.test.js
Expected Behavior
warnOnce should be found and loaded just like invariant.
Workaround
As a workaround I'm mocking react-native dependency with
jest.doMock('react-native', () => reactNativeMock))
Environment
The text was updated successfully, but these errors were encountered: