I have a gatsby site that uses a local package and it is not possible/allowed to make it public.
The site builds fine locally, but when I try to deploy it on Vercel, it can't find the package. I've found a few related issues but none of the solutions have worked for me so far.
The package is in Gatsby's static folder which is located in root and gets copied over to the public folder on build. In my package.json I have the following:
"devDependencies": {
"fslightbox-react": "file:./public/fslightbox-react-pro-1.4.2.tgz",
},
"scripts": {
"install-plugin": "cd public && yarn add fslightbox-react-pro-1.4.2.tgz",
"build": "yarn install-plugin && gatsby build",
},
Then in the Vercel settings I override the build command with yarn build
I've tried multiple variations of the install-plugin command and tried changing the path but I keep getting the following error when deploying:
error "./public/fslightbox-react-pro-1.4.2.tgz": Tarball is not in network and can not be located in cache (["/vercel/path0/public/fslightbox-react-pro-1.4.2.tgz","/vercel/.cache/yarn/v6/npm-fslightbox-react-1.4.2-aa6c77ceb2feb8487853163cb9a3d3a3d91ca85f/node_modules/fslightbox-react/.yarn-tarball.tgz"])
I previously was using npm and while the error message was slightly different, it basically also couldn't find the package in /vercel/path0/public/...
I'm almost sure this is something basic and I'm just overlooking something obvious but at this point, any help or pointers would be much appreciated.
SOLUTION so nobody has to dig through all the comments: No need for command overrides in vercel, just gotta fix up that install-plugin command a bit like so:
"install-plugin": "cd static && yarn add file:static/fslightbox-react-pro-1.4.2.tgz",
"build": "yarn install-plugin && gatsby build",
The package should be in the static folder which should be located in root