one icon indicating copy to clipboard operation
one copied to clipboard

Template projects with CLI not working out of the box

Open saent-x opened this issue 5 months ago • 3 comments

Current Behavior

When new projects are created with the CLI and dependencies are installed for Minimal Tamagui template, I still get an error when running the code without any changes:

🩹 Patching expo-modules-core 🩹 Patching @react-native-masked-view/masked-view 🩹 Patching @react-native/assets-registry [vite] connected. ✘ [ERROR] Could not resolve "expo-linear-gradient"

node_modules/moti/build/skeleton/expo.js:2:31:
  2 │ import { LinearGradient } from 'expo-linear-gradient';
    ╵                                ~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "expo-linear-gradient" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.

ERROR Build failed with 1 error: 12:18:45 AM node_modules/moti/build/skeleton/expo.js:2:31: ERROR: Could not resolve "expo-linear-gradient"

at failureErrorWithLog (node_modules/esbuild/lib/main.js:1467:15)
at node_modules/esbuild/lib/main.js:926:25
at node_modules/esbuild/lib/main.js:1345:9
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) 

ERROR Build failed with 1 error: 12:18:45 AM node_modules/moti/build/skeleton/expo.js:2:31: ERROR: Could not resolve "expo-linear-gradient"

error: script "dev" exited with code 1

Expected Behavior

The code should work well with no errors.

I believe this can be solved by adding a dependency for expo-linear-gradient in the package.json of the templates

One Version

1.1.506

Platform (Web, iOS, Android)

Web

Reproduction

1. Create a new project using `bunx one`
2. Select Minimal TamaGUI template
3. Run `bun install`
4. Run `bun run dev`

System Info

System:
    OS: macOS 26.0
    CPU: (12) arm64 Apple M4 Pro
    Memory: 88.77 MB / 24.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm
    pnpm: 10.7.1 - ~/.bun/bin/pnpm
    bun: 1.2.17 - ~/.bun/bin/bun
  Browsers:
    Safari: 26.0
  npmPackages:
    @biomejs/biome: 1.9.4 => 1.9.4 
    @react-native-community/cli: 19.0.0 => 19.0.0 
    @tamagui/animations-css: ^1.132.9 => 1.132.11 
    @tamagui/animations-moti: ^1.132.9 => 1.132.11 
    @tamagui/colors: ^1.132.9 => 1.132.11 
    @tamagui/config: ^1.132.9 => 1.132.11 
    @tamagui/image-next: ^1.132.9 => 1.132.11 
    @tamagui/lucide-icons: ^1.132.9 => 1.132.11 
    @tamagui/react-native-media-driver: ^1.132.9 => 1.132.11 
    @tamagui/shorthands: ^1.132.9 => 1.132.11 
    @tamagui/vite-plugin: ^1.132.9 => 1.132.11 
    @types/react: ^18.3.11 => 18.3.23 
    @vxrn/color-scheme: 1.1.506 => 1.1.506 
    expo: ^53.0.4 => 53.0.20 
    expo-linear-gradient: ^14.1.5 => 14.1.5 
    expo-modules-core: 2.3.13 => 2.3.13 
    one: 1.1.506 => 1.1.506 
    react: ~19.0.0 => 19.0.0 
    react-dom: ~19.0.0 => 19.0.0 
    react-native: ~0.79.2 => 0.79.5 
    react-native-reanimated: ^3.18.0 => 3.18.0 
    react-native-safe-area-context: 5.4.1 => 5.4.1 
    react-native-screens: 4.10.0 => 4.10.0 
    react-native-svg: 15.12.0 => 15.12.0 
    react-native-web: ~0.20.0 => 0.20.0 
    tamagui: ^1.132.9 => 1.132.11 
    typescript: ^5.7.3 => 5.8.3 
    vite: ^7.0.1 => 7.0.5

saent-x avatar Jul 21 '25 23:07 saent-x

npx expo install expo-linear-gradient should solve the problem

Avizura avatar Jul 29 '25 16:07 Avizura

Seems that new version of moti requires expo-linear-gradient.

zetavg avatar Jul 29 '25 20:07 zetavg

I had to start over with yarn to make it work

bruno-py avatar Aug 01 '25 12:08 bruno-py