Skip to content
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

New Typescript projects created with the CLI do not build/run correctly #22914

Closed
Sean-Brown-Digi opened this issue Jan 8, 2019 · 4 comments
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@Sean-Brown-Digi
Copy link

Sean-Brown-Digi commented Jan 8, 2019

Environment

Output of react-native info:

React Native Environment Info:
System:
OS: macOS 10.14.2
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 4.09 GB / 16.00 GB
Shell: 2.7.1 - /usr/local/bin/fish
Binaries:
Node: 8.11.4 - ~/.nvm/versions/node/v8.11.4/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 5.6.0 - ~/.nvm/versions/node/v8.11.4/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28
Build Tools: 23.0.1, 23.0.2, 23.0.3, 24.0.2, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.1, 27.0.3, 28.0.1, 28.0.2, 28.0.3
System Images: android-25 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.57.8 => 0.57.8

Description

I created a new typescript project with the CLI (e.g. react-native init <my project> --template typescript and am noticing several issues that I hope can be addressed.

  1. The project does not build. I run node ./node_modules/.bin/tsc and receive the following error: setup.js:1:1 - error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. To fix this I just set the isolatedModules setting in tsconfig.json to "false".
  2. The project does not run. After building the project and attempting to run the project on a connected device and that fails because it's looking for the APK file in the wrong place, e.g. react-native run-android --deviceId <my device id> results in the following:

adb: failed to stat app/build/outputs/apk/app-debug.apk: No such file or directory
Command failed: /usr/local/share/android-sdk/platform-tools/adb -s 99523a0828712a92 install app/build/outputs/apk/app-debug.apk
Could not install the app on the device, read the error above for details.

This is because the APK builds to apk/debug/app-debug.apk, not apk/app-debug.apk!!!

  1. I even tried explicitly adding the --variant debug flag and it still insists on looking for the APK in the parent folder (instead of in the "debug" child folder where the APK was built to).

After initializing the project I noticed several warnings related to missing peer dependencies. Some concerning ones relate to the version of react and the version of babel:

warning " > react-native@0.57.8" has unmet peer dependency "react@16.6.3".

warning "metro-react-native-babel-preset > @babel/plugin-transform-sticky-regex@7.2.0" has unmet peer dependency "@babel/core@^7.0.0-0".

Should I be concerned about these warnings? What should I do about these warnings?

Reproducible Demo

  1. run react-native init TestProject --template typescript. Notice all the warnings related to unmet peer dependencies (especially react-native's unmet peer dependency of REACT!!!)
  2. attempt to build the project via node ./node_modules/.bin/tsc -- it will fail because of the typescript configuration mentioned above
  3. fix the build error and attempt to run the project on a connected device via react-native run-android --deviceId <your device> and it will fail to install the APK on the device because it's looking in the wrong folder for the APK.
@Sean-Brown-Digi
Copy link
Author

Sean-Brown-Digi commented Jan 8, 2019

On second glance, it does look like the react version is set to 16.6.3, so I wonder why it says that dependency is "missing"?

@Sean-Brown-Digi
Copy link
Author

Looks like the CLI runs the app correctly if I don't specify the deviceId parameter

@bartolkaruza
Copy link

CLI related issues should be opened on the react-native-cli repo. I've created an issue there for you. Thanks for reporting! 👍

@bartolkaruza
Copy link

@Sean-Brown-Digi have a look @grabbou 's comment. It is best to only report one issue at a time.

@facebook facebook locked as resolved and limited conversation to collaborators Jan 9, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants