I have a sveltekit project that I try to upload to Firebase hosting with their new webframework support, but keep getting the following error (I have checked question How to host a sveltekit app with firebase hosting? , but it is not the new feature):
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/firebase
npm ERR! firebase@"10.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional firebase@"^9.9.0" from [email protected]
npm ERR! node_modules/firebase-frameworks
npm ERR! firebase-frameworks@"^0.10.4" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/firebase
npm ERR! peerOptional firebase@"^9.9.0" from [email protected]
npm ERR! node_modules/firebase-frameworks
npm ERR! firebase-frameworks@"^0.10.4" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! C:\Users\user\AppData\Local\npm-cache\_logs\2023-07-21T13_30_08_813Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Local\npm-cache\_logs\2023-07-21T13_30_08_813Z-debug-0.log
I know this feature is experimental, so what I do is :
firebase experiments:enable webframeworks
firebase init hosting
The project builds succesfully:
<build happens here>
Run npm run preview to preview your production build locally.
> Using @sveltejs/adapter-auto
Could not detect a supported production environment. See https://kit.svelte.dev/docs/adapters to learn how to configure your app to run on the platform of your choosing
✔ done
✓ built in 9.15s
This was working few weeks ago, but fails now. i tried to go with pnpm (since yarn does not play well with sveltekit) but it did not work either.
My package.json file is as follows:
{
"name": "<name>",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write ."
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.20.4",
"@tailwindcss/typography": "^0.5.9",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"autoprefixer": "^10.4.14",
"daisyui": "^3.2.1",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte": "^2.30.0",
"postcss": "^8.4.25",
"prettier": "^2.8.0",
"prettier-plugin-svelte": "^2.10.1",
"svelte": "^4.0.0",
"svelte-check": "^3.4.3",
"tailwindcss": "^3.3.2",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^4.3.6"
},
"type": "module",
"dependencies": {
"firebase": "^10.0.0",
"firebase-admin": "^11.9.0"
}
}
My firebase.json file is as follows:
{
"functions": [
{
"source": "functions",
"codebase": "default",
"ignore": [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log"
],
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
]
}
],
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"hosting": {
"source": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"frameworksBackend": {
"region": "europe-west1"
}
},
"storage": {
"rules": "storage.rules"
}
}
I tried to use yarn, it did not work at all. I tried pnpm, I got the same error. I tried to change the versions of the dependencies, that did not work, either. I tried to find the [email protected]
package in the .lock file, it was not there.
I was expecting to get a deployment to firebase.
I had the same problem here, I changed the dependencies in the package.json as follow
"dependencies": {
"firebase": "^9.23.0",
"firebase-admin": "^11.10.1",
"firebase-frameworks": "0.10.4"
}
and it let me deploy to Firebase.
Hope it helps