infinitered / ignite

Infinite Red's battle-tested React Native project boilerplate, along with a CLI, component/model generators, and more! 9 years of continuous development and counting.
MIT License
17.8k stars 1.41k forks source link

Android Manifest not found during linking with rnpm phase #138

Closed evanmrose closed 8 years ago

evanmrose commented 8 years ago

I ran ignite new app and got the following error:

`✔︎ Linking with rnpm fs.js:584 return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); ^

Error: ENOENT: no such file or directory, open 'dmx-native-mobile-redux/android/app/src/main/AndroidManifest.xml' at Error (native) at Object.fs.openSync (fs.js:584:18) at Object.fs.readFileSync (fs.js:431:33) at Object.insertInFile (/Users/erose2/.nvm/versions/node/v5.4.0/lib/node_modules/generator-react-native-ignite/utilities.js:21:27) at performInserts (/Users/erose2/.nvm/versions/node/v5.4.0/lib/node_modules/generator-react-native-ignite/app/index.js:60:13) at AppGenerator._updateAndroidManifest (/Users/erose2/.nvm/versions/node/v5.4.0/lib/node_modules/generator-react-native-ignite/app/index.js:328:7) at ChildProcess. (/Users/erose2/.nvm/versions/node/v5.4.0/lib/node_modules/generator-react-native-ignite/app/index.js:378:18) at emitTwo (events.js:87:13) at ChildProcess.emit (events.js:172:7) at maybeClose (internal/child_process.js:821:16)`

GantMan commented 8 years ago

Checking on this now

GantMan commented 8 years ago

I can't recreate this. Can you verify you have the latest rnpm?

image

Also, verify you have the latest released ignite. 0.3.1

GantMan commented 8 years ago

Additionally, can you verify that your AndroidManifest file exists or does not exist in the directory it is looking?

asndev commented 8 years ago

Running into the same with: rnpm 1.8.0 ignite 0.4.0

// reinstalling react-native-ignite fixed the problem. ( npm uninstall react-native-ignite && npm install -g react-native-ignite )

GantMan commented 8 years ago

Hrmmm odd! @evanmrose - did you try re-installing ignite?

@hknd, what version was Ignite when you first installed it? Maybe this is an upgrade issue?

asndev commented 8 years ago

@GantMan my first version was prolly 0.3.x. I did an upgrade to 0.4.0 and then I encountered that error. (then I resolved it via uninstall+install)

GantMan commented 8 years ago

thanks! It must have been some kind of upgrade limbo. I'll close this ticket for now. We'll revisit if we get anyone with this issue again.

Keksike commented 8 years ago

I'm having the same problem.

Tried reinstalling, didn't help.

✔︎ Linking with rnpm
⠋ Linking with rnpmfs.js:549
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open 'my-app/android/app/src/main/AndroidManifest.xml'
    at Error (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.readFileSync (fs.js:397:15)
    at Object.insertInFile (/usr/local/lib/node_modules/generator-react-native-ignite/utilities.js:21:27)
    at performInserts (/usr/local/lib/node_modules/generator-react-native-ignite/app/index.js:60:13)
    at AppGenerator._updateAndroidManifest (/usr/local/lib/node_modules/generator-react-native-ignite/app/index.js:328:7)
    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/generator-react-native-ignite/app/index.js:378:18)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:821:16)

MuadDib:~ Keksike$ rnpm -V 1.8.0

MuadDib:~ Keksike$ npm --version 3.9.5

GantMan commented 8 years ago

can you verify that the identified file exists? and at that path? my-app/android/app/src/main/AndroidManifest.xml

chuntley commented 8 years ago

Exact same issue here, the android folder does not exist.

It looks like ignite new does not perform the same project name validation as react-native init, causing the android build to fail silently.

For example, if you run ignite new my-app, this error will appear. If you run ignite new MyApp, it will succeed.

I hope that helps!

GantMan commented 8 years ago

awesome! Thanks so much! We're on it.

GantMan commented 8 years ago

released 1.0.1 -> https://github.com/infinitered/ignite/releases/tag/1.0.1

amrangaye commented 8 years ago

Hi. I updated to the 1.0.1 version, and have rnpm at 1.8.0, but still getting the same error, even sticking to just alphanumeric characters in my project name. The file isn't present, nor are the dirs above it.

Thanks.

GantMan commented 8 years ago

Hi @amrangaye So, you checked and the file/folders don't exist? There's our problem, so now we need to figure out why.

Can you please paste the path it's looking for, and also paste the path to your generated manifest file? You must have a manifest file generated somewhere under the android folder. I think identifying the difference here, we'll have the crux of the problem.

amrangaye commented 8 years ago

Sure. This is the path/error message:

Error: ENOENT: no such file or directory, open 'MyApp/android/app/src/main/AndroidManifest.xml

The android folder doesn't exist at all. Here is a list of dirs actually present in MyApp top level folder:

App Tests index.android.js npm-debug.log README.md git_hooks index.ios.js package.json

Thanks.

GantMan commented 8 years ago

ok, so something failed inside of generating the react native project at all. So the follow-up steps will fail.

Can you provide the contents of npm-debug.log as that file is only generated when an npm failure happens.

Additionally, can you attempt to build a new react-native project and verify that works? react-native init MyApp2 if it fails, please let us know what the error was.

amrangaye commented 8 years ago

OK so I looked in npm-debug.log, and it seems the initial set of problems were wrong permissions in my ~/.npm dir. I corrected those, and the script makes it a lot further, before failing. However now when I look in the MyApp dir there is no npm-debug.log file - is there another way of checking the error logs? Yes, react-native init MyApp2 works fine. Below is the error log for ignite:

⠋ Linking with rnpmfs.js:584
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open 'MyApp/android/app/src/main/AndroidManifest.xml'
    at Error (native)
    at Object.fs.openSync (fs.js:584:18)
    at Object.fs.readFileSync (fs.js:431:33)
    at Object.insertInFile (/usr/local/Cellar/node/6.2.0/libexec/npm/lib/node_modules/generator-react-native-ignite/utilities.js:21:27)
    at performInserts (/usr/local/Cellar/node/6.2.0/libexec/npm/lib/node_modules/generator-react-native-ignite/app/index.js:60:13)
    at AppGenerator._updateAndroidManifest (/usr/local/Cellar/node/6.2.0/libexec/npm/lib/node_modules/generator-react-native-ignite/app/index.js:328:7)
    at ChildProcess.<anonymous> (/usr/local/Cellar/node/6.2.0/libexec/npm/lib/node_modules/generator-react-native-ignite/app/index.js:378:18)
    at emitTwo (events.js:100:13)
    at ChildProcess.emit (events.js:185:7)
    at maybeClose (internal/child_process.js:827:16)`
GantMan commented 8 years ago

So, that file not existing is key. And the only way that file can not exist is if the react-native init MyApp is failing. My guess is that we're somehow swallowing that error, but until we find out how/what it is I can't really identify how to stop it.

The line that runs that inside ignite is this: https://github.com/infinitered/ignite/blob/master/ignite-generator/src/app/index.es#L193

As you can see we have stdio ignore for now, but in your personal node_module folder, you can turn int on, and see the feedback. I know that this goes pretty deep, but whatever is affecting ignite, might be affecting any React Native project you build.

Keksike commented 8 years ago

Btw, I am having this problem on OSX El Capitan. I was wondering if this might be an OSX specific problem?

VansonLeung commented 8 years ago

I am using El Capitan Hitting the same issue

Neither /android nor /ios is found.

✔︎ Found react-native ✔︎ Found git ✔︎ Found rnpm ✔︎ Getting ready for guests ✔︎ Running React Native setup (~ 1 minute) ✔︎ Downloading latest Ignite files ✔︎ Copying Ignite goodies create IgniteTest/README.md create IgniteTest/package.json create IgniteTest/index.ios.js create IgniteTest/index.android.js create IgniteTest/git_hooks/pre-commit/lint.sh create IgniteTest/Tests/Compiler.js create IgniteTest/Tests/mocha.opts create IgniteTest/Tests/Reducers/LoginReducerTest.js create IgniteTest/Tests/Sagas/LoginSagaTest.js create IgniteTest/Tests/Sagas/StartupSagaTest.js create IgniteTest/Tests/Setup.js create IgniteTest/App/Actions/Creators.js create IgniteTest/App/Actions/README.md create IgniteTest/App/Actions/Types.js create IgniteTest/App/Components/AlertMessageComponent.js create IgniteTest/App/Components/FullButton.js create IgniteTest/App/Components/ProgressiveImage.js create IgniteTest/App/Components/README.md create IgniteTest/App/Components/RoundedButton.js create IgniteTest/App/Components/Styles/AlertMessageComponentStyle.js create IgniteTest/App/Components/Styles/FullButtonStyle.js create IgniteTest/App/Components/Styles/ProgressiveImageStyle.js create IgniteTest/App/Components/Styles/README.md create IgniteTest/App/Components/Styles/RoundedButtonStyle.js create IgniteTest/App/Config/DebugSettings.js create IgniteTest/App/Config/PushConfig.js create IgniteTest/App/Config/ReactotronConfig.js create IgniteTest/App/Config/README.md create IgniteTest/App/Containers/AllComponentsScreen.js create IgniteTest/App/Containers/APITestingScreen.js create IgniteTest/App/Containers/DeviceInfoScreen.js create IgniteTest/App/Containers/ListviewExample.js create IgniteTest/App/Containers/LoginScreen.js create IgniteTest/App/Containers/PresentationScreen.js create IgniteTest/App/Containers/README.md create IgniteTest/App/Containers/Styles/AllComponentsScreenStyle.js create IgniteTest/App/Containers/Styles/APITestingScreenStyle.js create IgniteTest/App/Containers/Styles/DeviceInfoScreenStyle.js create IgniteTest/App/Containers/Styles/ListviewExampleStyle.js create IgniteTest/App/Containers/Styles/LoginScreenStyle.js create IgniteTest/App/Containers/Styles/PresentationScreenStyle.js create IgniteTest/App/Containers/Styles/README.md create IgniteTest/App/Containers/Styles/RootStyle.js create IgniteTest/App/Containers/Styles/ThemeScreenStyle.js create IgniteTest/App/Containers/Styles/UsageExamplesScreenStyle.js create IgniteTest/App/Containers/ThemeScreen.js create IgniteTest/App/Containers/UsageExamplesScreen.js create IgniteTest/App/Fixtures/boise.json create IgniteTest/App/Fixtures/README.md create IgniteTest/App/Fixtures/toronto.json create IgniteTest/App/I18n/I18n.js create IgniteTest/App/Images/BG.png create IgniteTest/App/Images/ignite_logo.png create IgniteTest/App/Images/ir.png create IgniteTest/App/Images/tile_bg.png create IgniteTest/App/Images/top_logo.png create IgniteTest/App/Images/top_logo@2x.png create IgniteTest/App/Images/top_logo@3x.png create IgniteTest/App/Lib/Utilities.js create IgniteTest/App/Navigation/index.js create IgniteTest/App/Navigation/NavButtons.js create IgniteTest/App/Navigation/NavigationBar.js create IgniteTest/App/Navigation/NavigationBarRouteMapper.js create IgniteTest/App/Navigation/README.md create IgniteTest/App/Navigation/Router.js create IgniteTest/App/Navigation/Routes.js create IgniteTest/App/Navigation/Styles/NavigationStyle.js create IgniteTest/App/Reducers/index.js create IgniteTest/App/Reducers/LoginReducer.js create IgniteTest/App/Reducers/README.md create IgniteTest/App/Reducers/WeatherReducer.js create IgniteTest/App/Root.js create IgniteTest/App/Sagas/GetCityWeatherSaga.js create IgniteTest/App/Sagas/index.js create IgniteTest/App/Sagas/LoginSaga.js create IgniteTest/App/Sagas/StartupSaga.js create IgniteTest/App/Services/Api.js create IgniteTest/App/Services/ExamplesRegistry.js create IgniteTest/App/Services/FixtureApi.js create IgniteTest/App/Store/ImmutablePersistenceTransform.js create IgniteTest/App/Store/Store.js create IgniteTest/App/Themes/ApplicationStyles.js create IgniteTest/App/Themes/Colors.js create IgniteTest/App/Themes/Fonts.js create IgniteTest/App/Themes/Images.js create IgniteTest/App/Themes/index.js create IgniteTest/App/Themes/Metrics.js create IgniteTest/App/Themes/README.md create IgniteTest/App/Themes/Transitions.js ✔︎ Installing Ignite dependencies (~30 seconds-ish) ✔︎ Linking with rnpm ⠋ Linking with rnpmfs.js:549 return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); ^

Error: ENOENT: no such file or directory, open 'IgniteTest/android/app/src/main/AndroidManifest.xml' at Error (native) at Object.fs.openSync (fs.js:549:18) at Object.fs.readFileSync (fs.js:397:15) at Object.insertInFile (/usr/local/lib/node_modules/generator-react-native-ignite/utilities.js:21:27) at performInserts (/usr/local/lib/node_modules/generator-react-native-ignite/app/index.js:60:13) at AppGenerator._updateAndroidManifest (/usr/local/lib/node_modules/generator-react-native-ignite/app/index.js:328:7) at ChildProcess. (/usr/local/lib/node_modules/generator-react-native-ignite/app/index.js:378:18) at emitTwo (events.js:87:13) at ChildProcess.emit (events.js:172:7) at maybeClose (internal/child_process.js:818:16)

GantMan commented 8 years ago

Does the file get created at all? Can you check for it now?

Also, can you do a normal react-native init SomeProject just fine?

VansonLeung commented 8 years ago

the file does not get created at all but I ran react-native init Project is fine, all the files are created

GantMan commented 8 years ago

this happens every time? @skellock thoughts on how to best track this down?

@VansonLeung - we can help create a branch version perhaps, that would be verbose in each step, rather than swallowing output. Maybe then, it would identify the problem.

GantMan commented 8 years ago

make sure you have latest ignite npm i react-native-ignite -g and try again. If this fails, would you be open to a screen pairing session?

skellock commented 8 years ago

I can reproduce like this:

mkdir -p ~/tmp
cd ~/tmp
ignite new Test
cd Test
ignite new Boom

When it can't find AndroidManifest.xml, it doesn't even have an ios or android directory.

react-native init fails, but we still put the ignite bootstrap files in there.

Should be able to fix this pretty easily.

Sorry for the inconvenience. This was a bit goofy to track down.

will-hart commented 8 years ago

I was running into this issue on Win10 with cmder. There was no npm debug log. Running react-native init myapp gave me:

λ react-native init AppRN
   Looks like you installed react-native globally, maybe you meant react-native-cli?
   To fix the issue, run:
   npm uninstall -g react-native
   npm install -g react-native-cli

Doing this let ignite new run without error.

GantMan commented 8 years ago

@will-hart - That's awesome info! @skellock I'm thinking of building this check into our CLI, thoughts on best way?

https://github.com/facebook/react-native/blob/8295d27a906f850cefd86321d212162cba7ef296/local-cli/wrong-react-native.js

evanmrose commented 8 years ago

hey @GantMan any movement on this? I ran into another wonky issue:

__fbBatchedBridge is undefined

This led me to try to re-scaffold the app and start from scratch but I ran into this issue again.

GantMan commented 8 years ago

I created a fresh project about an hour ago. Can you give it a go? I had no issue.

make sure you have everything upgraded/updated

skellock commented 8 years ago

Sorry, just going through issues and I've missed this one.

@GantMan We could put that check into the cli if you wanted ya.

Something like this might do the trick:

const cmd = 'npm -s -g ls --depth=0' // lists top level global installed packages
const ohCrap = Shell.exec(cmd, { silent: true }).stdout.indexOf('react-native@') >= 0

I mean, we'll only present the same error that react-native does anyway... but sooner. I guess that's a little better though.

GantMan commented 8 years ago

yeah, there's a good bit of checks/balances we can work in to try to help people with borked installs etc. Would be cool to get other team members to maybe PR that.

skellock commented 8 years ago

Upgraded to #276. Thanks all.