I am running a NextJS application in a NPM workspace monorepo, and I am getting what appears to be a dependency issue. Installs work fine locally, but when I push to github to get a deploy preview working, I run into the following error.
Failed during stage 'Install dependencies': dependency_installation script returned non-zero exit code: 1
npm ERR! code ERR_INVALID_ARG_TYPE
npm ERR! The "from" argument must be of type string. Received undefined
npm ERR! A complete log of this run can be found in: /opt/buildhome/.npm/_logs/2024-04-26T02_47_11_568Z-debug-0.log
When I add error log level i get the following stack trace, which doesnt give me much more to work with.
npm verb stack at new NodeError (node:internal/errors:405:5)
npm verb stack at validateString (node:internal/validators:162:11)
npm verb stack at relative (node:path:1190:5)
npm verb stack at /opt/buildhome/.nvm/versions/node/v18.17.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:1129:21
npm verb stack at Array.map (<anonymous>)
npm verb stack at /opt/buildhome/.nvm/versions/node/v18.17.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:1127:66
npm verb stack at Array.map (<anonymous>)
npm verb stack at [rollbackMoveBackRetiredUnchanged] (/opt/buildhome/.nvm/versions/node/v18.17.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:1127:8)
npm verb stack at [reifyPackages] (/opt/buildhome/.nvm/versions/node/v18.17.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:251:31)
npm verb stack at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Clearing cache and retriggering resolves the issue, but returns on new branches. I see others have had similiar issues and have tried all of the suggested remedies with no avail.