server
server copied to clipboard
MODULE_NOT_FOUND Cannot find module 'vue'
Hey After I setup SSR and run "node ssr.js" it throws errors like MODULE_NOT_FOUND Cannot find module 'vue'. I have only vue-server as prod dependency in package.json. All other packages are dev dependencies. Should I move Vue and other packages to dependencies from devDepencendies? p.s. I compile my assets in development env.
Having the same issue more or less. Are you using vite, or webpack or what?
Having the same issue more or less. Are you using vite, or webpack or what?
Webpack. I fix that problem by making dev dependencies available on production in package.json
So you're saying you have node_modules
installed in production servers? Or maybe I'm misunderstanding ...
So you're saying you have
node_modules
installed in production servers? Or maybe I'm misunderstanding ...
I just moved my devDependencies to dependencies in package.json and now its working. That's happened probably because we compile our js & css assets somewhere else than inertia project folder (in my case its github actions).
Btw also you can try to remove externals: [webpackNodeExternals()],
in webpack.mix.js - that should include vue and other vendors in your ssr.js, but in my case it does not work (i don't have much time to find why).
I use Vite, not Webpack, but I do use Github Actions to compile all my assets for both my app and ssr but on my Ubuntu server it won't start up. Says it can't find vue.
I wonder if I need to somehow build a vendors javascript file that I can point the vue alias at for ssr? I'm really not understanding why it's not working.
@RomanSarvarov
Can you be explicit please about which dev dependencies you moved to dependencies?
Nothing seems to work for me except actually installing node_modules on my server.
The SSR compilation should bundle all dependencies into the ssr.js file so that no other files are required to run. It's only loaded once, and done so via a background process so size isn't an issue.