I'm trying to work through a Svelte starter project on MDN. I was able to run the first step of the project locally after using npx but when I tried to clone the Github repo I keep getting an error on npm run dev
.
I'm on a Mac running Ventura 13.6.7.
I followed the instructions for creating your first Svelte app these terminal commands got it up and running:
npx degit sveltejs/template moz-todo-sveltecd moz-todo-sveltenpm installnpm run dev
But when I followed these instructions for downloading the rest of the project, I cloned the project, navigated to the subfolder, ran npm install
and then npm run dev
. It keeps generating an error:
Error: Package subpath './compiler.js' is not defined by "exports" in /Users/eskinb/moz-todo-svelte/mdn-svelte-tutorial/02-starting-our-todo-app/node_modules/svelte/package.json at exportsNotFound (node:internal/modules/esm/resolve:304:10) at packageExportsResolve (node:internal/modules/esm/resolve:651:9) at resolveExports (node:internal/modules/cjs/loader:592:36) at Function.Module._findPath (node:internal/modules/cjs/loader:669:31) at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1131:27) at Function.Module._load (node:internal/modules/cjs/loader:986:27) at Module.require (node:internal/modules/cjs/loader:1233:19) at require (node:internal/modules/helpers:179:18) at Object.<anonymous> (/Users/eskinb/moz-todo-svelte/mdn-svelte-tutorial/02-starting-our-todo-app/node_modules/rollup-plugin-svelte/index.js:11:4) at Module._compile (node:internal/modules/cjs/loader:1358:14)
The first time I ran npm install
I got a warnings and was told to do npm audit fix
. The above error appeared both before and after I did the fix.
I tried removing and reinstalling node_modules in the cloned version of the project.
I tried the Mac Terminal program and the one in Visual Studio Code.
I tried updating Node.js and that did not solve it.
This StackExchange post suggested npm cache clear --force
but the warning on npm cache clear
scared me off forcing it.