I have a project with the following structure:
packages
app
| remix
| app
| package.json
| ...
| ...
package.json
tsconfig.json
The remix
project requires some dependencies from the packages
folder, but this dependencies are installed globally in the root package.json
file.
Currently on my machine the entire project works correctly, I simply have to run npm i && npm run build:packages
and then just npm run dev:remix
from the root of the project to correctly start the remix
project:
❯ npm run dev:remix
> dev:remix
> cd app/remix && npm run dev
> dev
> remix dev
Loading environment variables from .env
Building...
Built in 5.5s
Waiting for app server (531dff8b)
> remix-serve api/index.js
Remix dev server ready
Remix App Server started at http://localhost:3000 (http://192.168.1.142:3000)
App server took 1s
The top root dev:remix
script is simply an alias declared as "dev:remix": "cd app/remix && npm run dev",
.
Now I need to deploy it on Vercel (I use terraform for this), the vercel project is configured with the followings:
framework: Remix
rootDirectory: app/remix
installCommand: cd ../.. && npm i
buildComand: cd ../.. && bash scripts/buildDeploy.sh
The buildDeploy.sh
script is a simple script that build the packages with build:packages
plus other things.
The build of the deploy is fine:
...
Building Remix app in production mode...
Built in 7.5s
But the developmentCommand
(the default one, remix dev
) results in the following error:
Error: EISDIR: illegal operation on a directory, unlink '/vercel/path0/node_modules/@remix-run/dev'
EISDIR: EISDIR: illegal operation on a directory, unlink '/vercel/path0/node_modules/@remix-run/dev'
It uses the developmentCommand
because the deploy is not a production one, but a preview one.
What is wrong with this? How can I solve it?