Error: Cannot find module '/tmp/rncli-init-template-LJ4MxS/node_modules/typescript/template.config'
gitowiec opened this issue · 4 comments
Environment
System:
OS: Linux 5.1 Ubuntu 18.04.2 LTS (Bionic Beaver)
CPU: (8) x64 Intel(R) Core(TM) i7-3610QM CPU @ 2.30GHz
Memory: 422.88 MB / 15.52 GB
Shell: 4.4.20 - /bin/bash
Binaries:
Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
Yarn: 1.17.3 - /usr/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
Android SDK:
API Levels: 23, 25, 26, 27, 28
Build Tools: 23.0.1, 25.0.0, 26.0.2, 26.0.3, 27.0.3, 28.0.3
System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-28 | Intel x86 Atom_64
npmPackages:
@react-native-community/cli: ^2.8.0 => 2.8.0
Description
Running (as stated here https://github.com/react-native-community/cli/blob/master/docs/init.md)
npx react-native init my_app --template react-native-template-typescript --npm
Or (as stated here https://github.com/react-native-community/react-native-template-typescript)
npx react-native init my_app --template typescript --npm
Throws this error
Error: Cannot find module '/tmp/rncli-init-template-4tdNq7/node_modules/typescript/template.config'
or this
Error: Cannot find module '/tmp/rncli-init-template-LJ4MxS/node_modules/typescript/template.config'
Unfortunately same thing happens when I downloaded react-native-template-typescript, unpacked it into folder and called npx react-native init my_project --template file:///home/user/workspace/my_project/react-native-template-typescript-master --npm or without --npm :(
I had the same problem couple weeks ago. I think this has to do that, as far as I know, the TS template doesn't support the different React Native CLI versions (see here).
Use next tag of TS template for now:
npx react-native init MyApp --template react-native-template-typescript@next
Use:
npx react-native init AwesomeTSProject --template react-native-template-typescript