expo using template
I tried to follow the instructions for this template.
https://www.convex.dev/templates/monorepo
It kind of seems to work but not really.
I ran
1. npm create convex -- -t get-convex/turbo-expo-nextjs-clerk-convex-monorepo
than
2. npm run dev
this gives a QR for expo go, and a url for the website. Both give the errors
start uop warning and errors:
native-app:dev: Starting project at /Users/ashleylorettedills/tony/src/elam_5_3/my-app/apps/native
native-app:dev: (node:48999) [DEP0040] DeprecationWarning: The
punycode
module is deprecated. Please use a userland alternative instead.
native-app:dev: (Use node --trace-deprecation ...
to show where the warning was created)
web-app:dev: ▲ Next.js 14.0.4
web-app:dev: - Local: http://localhost:3001
web-app:dev: - Environments: .env.local
web-app:dev:
⠸ Preparing Convex functions...
web-app:dev: npm ERR! code ENOWORKSPACES
web-app:dev: npm ERR! This command does not support workspaces.
web-app:dev:
✔ 13:24:09 Convex functions ready! (549.04ms)
Starting Metro Bundler
native-app:dev: The following packages should be updated for best compatibility with the installed expo version:
native-app:dev: react-native@0.73.2 - expected version: 0.73.6
native-app:dev: Your project may not work correctly until you install the correct versions of the packages.
web errors
./src/app/ConvexClientProvider.tsx:4:0
Module not found: Can't resolve 'convex/react'
2 |
3 | import { ReactNode } from 'react';
4 | import { ConvexReactClient } from 'convex/react';5 | import { ConvexProviderWithClerk } from 'convex/react-clerk'; 6 | import { ClerkProvider, useAuth } from '@clerk/clerk-react'; 7 | import { ErrorBoundary } from './ErrorBoundary'; expo go error ConvexReactClient related error, cant reproduce right now doesn't work on my work wifi
Templates
The backend application platform with everything you need to build your product.
26 Replies
if I try
npm install convex
i get this error
MacBook-Air:my-app ashleylorettedills$ npm install convex
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: my-app@undefined
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR! peerOptional react@">=16" from @clerk/shared@1.4.1
npm ERR! node_modules/@clerk/backend/node_modules/@cler.....
One thing: the monorepo template says you should use pnpm or yarn, but the create convex command installs with npm by default. So you probably want to delete all node_modules folders and use pnpm instead.
Try using the installation instructions from the README and report back if that works for you: https://github.com/get-convex/turbo-expo-nextjs-clerk-convex-monorepo#using-this-example
GitHub
GitHub - get-convex/turbo-expo-nextjs-clerk-convex-monorepo: Monore...
Monorepo template with Turborepo, Next.js, Expo, Clerk, Convex - get-convex/turbo-expo-nextjs-clerk-convex-monorepo
Will do
@ian do I start by running
npm create convex -- -t get-convex/turbo-expo-nextjs-clerk-convex-monorepo
than follow the instructions? or do I just clone the repo first?
the first one, it will add the files to your local worktree and then you can commit them and start a new repo
I had followed the instruction except had used npm run install instead of pnpm i
now I
1. deleted npm-modules
2. pnpm i
got following warnings
Scope: all 4 workspace projects
apps/native | WARN Moving expo that was installed by a different package manager to "node_modules/.ignored"
apps/web | WARN Moving postcss that was installed by a different package manager to "node_modules/.ignored"
apps/web | WARN Moving @clerk/clerk-react that was installed by a different package manager to "node_modules/.ignored"
apps/web | WARN Moving @clerk/nextjs that was installed by a different package manager to "node_modules/.ignored"
apps/web | WARN Moving @headlessui/react that was installed by a different package manager to "node_modules/.ignored"
WARN 6 other warnings
WARN deprecated expo-cli@6.3.10: The global Expo CLI has been superseded by 'npx expo' and eas-cli –– Learn more: https://blog.expo.dev/the-new-expo-cli-f4250d8e3421
/Users/ashleylorettedills/tony/src/elam_5_3/my-app/apps/native:
ERR_PNPM_FETCH_404 GET https://registry.npmjs.org/@packages%2Fbackend: Not Found - 404
3. ran npm run dev
dev turbo run devsh: turbo: command not found I can try again starting over from the begining
yeah if you want to use a different package manager I'd clear and start over
How do I do the run command with pnpm
are the instructions correct?
I have only used npm in the past. Basically all my experience is from following convex examples
the instruction are
1. https://www.convex.dev/templates/monorepo
npm create convex -- -t get-convex/turbo-expo-nextjs-clerk-convex-monorepo
2. follow instruction in readme
1) Install dependencies with
yarn
or pnpm i
.
2) Configure Convex:
Note: The following commands will throw an error and ask you to add the appropriate environment variables to proceed. Continue reading on for how to do that.Is that right? do something with npm than pnpm than npm again. Does that make sense, is it normally to use both
Templates
The backend application platform with everything you need to build your product.
also it says turbo is missing, should install it globally with pnpm? https://turbo.build/repo/docs/installing
@erquhart I think the only remaining error after adding the configs
Module not found: Can't resolve 'convex/react'
$ pnpm i
Scope: all 4 workspace projects
.../app-3/apps/native:
ERR_PNPM_FETCH_404 GET https://registry.npmjs.org/@packages%2Fbackend: Not Found - 404
This error happened while installing a direct dependency of ../app-3/apps/native
@packages/backend is not in the npm registry, or you have no permission to fetch it.
No authorization header was set for the request.
Progress: resolved 1, reused 0, downloaded 0, added 0
Downloading react-native@0.73.2: 4.23 kB/23.07 MB
If I start form scratch and follow instructions as best as possible, and than follow the errors that point to the necessary configs, eventually the one error from both expo go and web is just Module not found: Can't resolve 'convex/react'
but if I try removing node_modules and than run pnpm i get other errors
@packages/backend is not in the npm registry, or you have no permission to fetch it.
and than if I run
web-app:dev: cache bypass, force executing 68f0d31fc6efa387
native-app:dev: cache bypass, force executing e51618b7018fe5a7
@packages/backend:dev: cache bypass, force executing 50832ba40d6774b4
web-app:dev:
web-app:dev: > web-app@0.1.0 dev
web-app:dev: > next dev
web-app:dev:
native-app:dev:
native-app:dev: > native-app@1.0.0 dev
native-app:dev: > expo start
native-app:dev:
@packages/backend:dev:
@packages/backend:dev: > @packages/backend@1.0.0 dev
@packages/backend:dev: > convex dev
@packages/backend:dev:
native-app:dev: sh: expo: command not found
@packages/backend:dev: sh: convex: command not found
web-app:dev: sh: next: command not found
@packages/backend:dev: npm ERR! Lifecycle script
dev failed with error:
native-app:dev: npm ERR! Lifecycle script
dev failed with error:
web-app:dev: npm ERR! Lifecycle script
dev failed with error:
@packages/backend:dev: npm ERR! Error: command failed
@packages/backend:dev: npm ERR! in workspace: @packages/backend@1.0.0
native-app:dev: npm ERR! Error: command failed
web-app:dev: npm ERR! Error: command failed
web-app:dev: npm ERR! in workspace: web-app@0.1.0
@packages/backend:dev: npm ERR! at location: /Users/ashleylorettedills/tony/src/elam_5_3/my-app/packages/backend
native-app:dev: npm ERR! in workspace: native-app@1.0.0
web-app:dev: npm ERR! at location: /Users/ashleylorettedills/tony/src/elam_5_3/my-app/apps/web
native-app:dev: npm ERR! at location: /Users/ashleylorettedills/tony/src/elam_5_3/my-app/apps/native
All of the convex commands you should run from the packages/backend directory. Sorry it’s been giving you trouble. Convex isn’t installed on the root package, but in the sub package.
pnpm manages the packages, but things like
npm run
work regardless of your package manager. I agree it’s confusing. I’m not by a terminal to try installing fresh right now, sorry. The npm create convex command is just a glorified git clone but it might try to do npm i automatically so I’d just clone and follow the readme. If you do npm install first, your packages will be a mix, and it might get confused about @packages/backend which is just a local workspace package (from that directory) not from npmjsTo reiterate: Follow the instructions in the repo, not on the convex.dev/templates website.
Here you can find how to install pnpm: https://pnpm.io/installation
Installation | pnpm
Prerequisites
I had trouble with this starter template as well. Cloning it from GitHub worked for me
Thank you
getting this error
ERR_PNPM_FETCH_404 GET http://registry.npmjs.org/@packages%2Fbackend: Not Found - 404
Have you tried from a fresh clone?
@Michal Srb yes I did the following three steps
1. git clone git@github.com:get-convex/turbo-expo-nextjs-clerk-convex-monorepo.git
2. cd turbo-expo-nextjs-clerk-convex-monorepo
3. pnpm i
ERR_PNPM_FETCH_404 GET http://registry.npmjs.org/@packages%2Fbackend: Not Found - 404
@packages/backend is not in the npm registry, or you have no permission to fetch it.
get the same error whether I run pnpm i in the main directory or in packages/backend
npm install --save packages/backend/
seems to fix it
It’s pretty cool to see it run as an app
I can't reproduce the installation problem. I ran:
and got no errors. Are you on windows?
No osx
I’ve never used pnpm before but it seems to work, in general but here I get an error
How does it know that packages/backend should be local?
running
npm install --save packages/backend/
adds the below to the end of the packages.json file
,
"dependencies": {
"@packages/backend": "^1.0.0"
}
It's in
pnpm-workspace.yaml
and workspaces
in package.json
I also ran this with a fresh clone and had no issues:
Here's some things to check:
But unfortunately we can't reproduce your issue, so you'll have to do more debugging on your endpnpm --version
9.1.0
npm --version
10.2.4
node --version
v21.6.2
Hey @burnstony#1975 can you try Yarn 1.0 instead? I had better luck with it and it's the only package manager officially supported by expo.
npm i -g yarn
yarn
(after you delete all node_modules folders in the monorepo)OK - trying yarn now
Yarn worked, but it still doesn’t respond to pressing i