[Bug]: zapier push fails with npm workspaces
mdesousa opened this issue · comments
Bug Description
Executing zapier push
fails with an error:
Looks like you're missing a local installation of zapier-platform-core. Run `npm install` to resolve
Reproduction Steps
- in the package.json at the root of the monorepo, add a folder
/my-adapter
and include it in the list of workspaces (see npm workspaces) - from the monorepo root, install zapier packages:
npm install zapier-platform-cli zapier-platform-core --workspace my-adapter
- implement the code for a zapier adapter in
/my-adapter
cd ./my-adapter && npm run build && npx zapier push
throws an error complaining about missing local installation
Zapier Platform version
14.0.0
Node.js version
18.15.0
Your Operating System
macos
npm/yarn version
9.6.3
App ID
160973
More Details
No response
same issue with pnpm
workspaces! did you find a solution? most likely due to simlinks...
we are using a workaround:
- temporarily remove the workspace from /package.json
cd ./my-adapter && npm install && npm run build && npx zapier push
for pnpm users, this can be a bit simpler.
to build:
- if you are using
workspace:*
dependencies, usejq
to remove them. note that you can only use workspace deps as dev dependencies pnpm install --ignore-workspaces
zapier build
to reset after build (if required):
- add workspace deps back
- remove
pnpm-lock.yml
and./build
andnode_modules
- run
pnpm install
{
"clean": "rm -rf .turbo && rm -rf lint-results && rm -rf .nyc_output && rm -rf node_modules && rm -rf dist && rm -rf build && rm pnpm-lock.yaml",
"build": "contents=\"$(jq 'del(..|select(. == \"workspace:*\"))' package.json)\" && echo \"${contents}\" > package.json && pnpm install --ignore-workspace && zapier build",
"reset": "contents=\"$(jq '.devDependencies.\"@hellomateo/eslint-config-custom-node\" = \"workspace:*\" | .devDependencies.\"@hellomateo/prettier-config\" = \"workspace:*\" | .devDependencies.\"@hellomateo/jest-presets\" = \"workspace:*\"' package.json)\" && echo \"${contents}\" > package.json && pnpm run clean && pnpm install",
"deploy": "if [ \"$ENV\" = \"dev\" ]; then pnpm run build && zapier upload && pnpm run reset; else echo \"pnpm run promote\"; fi"
}
Getting the same issue with yarn workspaces.
Getting the same issue with a lerna monorepo. A solution that works for us is downgrading to 13.0.0