-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@sveltejs/kit' on production build #1257
Comments
I ran into this the other day. (cc @Rich-Harris) Rich agreed that this was probably actually a bug. The server-side output that's sent to the Node adapter should probably be re-bundled within the adapter itself, like is happening for some other adapters. In the meantime as a workaround, you can move |
Same issue and above workaround did NOT work for me. Now it complains about missing |
Same issue with me. Trying deploying to heroku using 2021-05-26T13:05:39.000000+00:00 app[api]: Build succeeded 2021-05-26T13:05:41.632730+00:00 heroku[web.1]: Starting process with command `npm start` 2021-05-26T13:05:48.381759+00:00 app[web.1]: 2021-05-26T13:05:48.381783+00:00 app[web.1]: > [email protected] start /app 2021-05-26T13:05:48.381784+00:00 app[web.1]: > node build 2021-05-26T13:05:48.381784+00:00 app[web.1]: 2021-05-26T13:05:48.727284+00:00 app[web.1]: internal/process/esm_loader.js:74 2021-05-26T13:05:48.727483+00:00 app[web.1]: internalBinding('errors').triggerUncaughtException( 2021-05-26T13:05:48.727485+00:00 app[web.1]: ^ 2021-05-26T13:05:48.727485+00:00 app[web.1]: 2021-05-26T13:05:48.727486+00:00 app[web.1]: Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@sveltejs/kit' imported from /app/build/app.js 2021-05-26T13:05:48.727487+00:00 app[web.1]: at packageResolve (internal/modules/esm/resolve.js:655:9) 2021-05-26T13:05:48.727487+00:00 app[web.1]: at moduleResolve (internal/modules/esm/resolve.js:696:18) 2021-05-26T13:05:48.727488+00:00 app[web.1]: at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:810:11) 2021-05-26T13:05:48.727488+00:00 app[web.1]: at Loader.resolve (internal/modules/esm/loader.js:88:40) 2021-05-26T13:05:48.727489+00:00 app[web.1]: at Loader.getModuleJob (internal/modules/esm/loader.js:241:28) 2021-05-26T13:05:48.727489+00:00 app[web.1]: at ModuleWrap. (internal/modules/esm/module_job.js:56:40) 2021-05-26T13:05:48.727490+00:00 app[web.1]: at link (internal/modules/esm/module_job.js:55:36) { 2021-05-26T13:05:48.727490+00:00 app[web.1]: code: 'ERR_MODULE_NOT_FOUND' 2021-05-26T13:05:48.727491+00:00 app[web.1]: } 2021-05-26T13:05:48.783848+00:00 app[web.1]: npm ERR! code ELIFECYCLE 2021-05-26T13:05:48.783850+00:00 app[web.1]: npm ERR! errno 1 2021-05-26T13:05:48.799210+00:00 app[web.1]: npm ERR! [email protected] start: `node build` 2021-05-26T13:05:48.799211+00:00 app[web.1]: npm ERR! Exit status 1 2021-05-26T13:05:48.799212+00:00 app[web.1]: npm ERR! 2021-05-26T13:05:48.799213+00:00 app[web.1]: npm ERR! Failed at the [email protected] start script. 2021-05-26T13:05:48.799214+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 2021-05-26T13:05:49.642211+00:00 app[web.1]: 2021-05-26T13:05:49.654457+00:00 app[web.1]: npm ERR! A complete log of this run can be found in: 2021-05-26T13:05:49.654641+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-05-26T13_05_48_797Z-debug.log 2021-05-26T13:05:49.805437+00:00 heroku[web.1]: Process exited with status 1 2021-05-26T13:05:49.911449+00:00 heroku[web.1]: State changed from starting to crashed 2021-05-26T13:14:45.371410+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=mbaw.herokuapp.com request_id=eea42cf2-42a7-4ebf-a32d-65d92f4f638b fwd="187.8.172.13" dyno= connect= service= status=503 bytes= protocol=https 2021-05-26T13:14:45.904804+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=mbaw.herokuapp.com request_id=1319728b-26fb-49c9-bd22-dadf50c29172 fwd="187.8.172.13" dyno= connect= service= status=503 bytes= protocol=https |
@katkrasinsk is
|
@utkarshkukreti tried with the 'workaround' and still, it then complains on |
@katkrasinsk what if you add |
@utkarshkukreti it does work with adding svelte as dep, but I got a much bigger build, anyway, I am with this solution in order to continue developing the app. |
I noticed that I didn't have "@sveltejs/adapter-node" in my dependencies. Now it's building fine. I wonder if others are doing this by mistake as well. |
I have the same error after latest updates:
|
I encountered the same error: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/helena/svelte/personal-website/.svelte-kit/output/routes/blog/0/+page.md' imported from /Users/helena/svelte/personal-website/.svelte-kit/output/server/chunks/index2.js |
@bitdom8 @helenawsu commenting on 2-year-old closed issues will not usually get a helpful response. If you're encountering a new bug with SvelteKit, please open a new issue with a minimal reproduction |
The reason to this was I was using adaptor-static and used dynamic import. I can't build static with dynamic import. |
Does quitting VSCode and restarting it back up work for anyone? It worked for me. |
Describe the bug
When I create a new SvelteKit project with the
node
adapter and try to use the files in thebuild
directory, I get the following error:Logs
To Reproduce
adapter-node
to it"next"
as versionyarn && yarn build
build
directory (I only want the production files in my production environment) by moving it somewhere elsepackage.json
file to the directory with the contents:{ "type": "module" }
(for ESM)node .
<- This is what triggers the bugExpected behavior
I expect the
build
directory to contain everything that is needed to run the app in isolation. Adding the smallpackage.json
file is another thing that I do not want to do myself.When running
node .
the server should just run.Information about your SvelteKit Installation:
Diagnostics
Severity
It's kind of annoying as I really want my production setup to be ready, but it doesn't stop me from development.
Additional context
All the above steps are done in a Dockerfile for production but I was able to reproduce it outside as well
Dockerfile
The text was updated successfully, but these errors were encountered: