-
Notifications
You must be signed in to change notification settings - Fork 11
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
MODULE_NOT_FOUND Cannot find module 'vue' #2
Comments
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 |
I just moved my devDependencies to dependencies in package.json and now its working. Btw also you can try to remove |
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. |
@secondmanveran Have you figured this out? Also having this issue with Laravel Jetstream SSR |
Yeah as far as I've found, you have to have a It does become a little tricky in that you need to run Let me know if you need a Forge deploy setup, I can share mine with you. |
@secondmanveran In out setup in Forge, we install the packages, run build, then remove the node_modules. We found that removing node_modules does not make it work. So after remove node_modules, we install vite, npm install vite --save-dev. Then it works. That is the best we found so far. |
Whether it should be vite installed right after or can be other packages. We haven't tested it. |
Then why the hell did you ask if you have a solution? |
Sorry. I didn't mean to say that in a bad way. My apologies. I was asking because, you might have other solution that could be better. And really looking to a solution where it does not need to install vite right after. My bad. |
Thank you for the response by the way. I appreciate it. |
Ah. Nope. I'm not sure what vite would have to do with it, if you run build before you delete the node_modules, then your build is done. Vite is a build tool, it isn't used in production that I'm aware of ... so no ... I have nothing for you. Best. |
Yeah was thinking it might not be about Vite at all. But thank you for the responses. I appreciate it. |
@secondmanveran If you don't mind, can you share your Forge deploy setup for this? It would really help it case our solution won't work anymore. |
Sure. This specific site uses Jetstream and Octane so you'll see the The important part is to reset your local git repo to remove any uncommitted files so git will actually pull your files down. cd /home/forge/example.com
git reset --hard
git fetch origin $FORGE_SITE_BRANCH --tags
latest=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $latest
git reset --hard $latest
$FORGE_COMPOSER install --no-dev --no-interaction --prefer-dist --optimize-autoloader
( flock -w 10 9 || exit 1
echo 'Restarting FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9>/tmp/fpmlock
if [ -f artisan ]; then
$FORGE_PHP artisan down
$FORGE_PHP artisan migrate --force
$FORGE_PHP artisan optimize:clear
npm install
npm run prod
! $FORGE_PHP artisan octane:status || $FORGE_PHP artisan octane:reload
$FORGE_PHP artisan horizon:terminate
$FORGE_PHP artisan inertia:stop-ssr
$FORGE_PHP artisan up
fi Hope some of this can be of use for you. Best. |
Got it. Thank you |
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.
The text was updated successfully, but these errors were encountered: