My package.json build script is tsc and function's commands are npm install && npm run build. Here are the deployment logs:
2025-06-19T15:14:36.849527828Z [15:14:36] [open-runtimes] Environment preparation started.
2025-06-19T15:14:36.968371251Z [15:14:36] [open-runtimes] Environment preparation finished.
2025-06-19T15:14:36.969603016Z [15:14:36] [open-runtimes] Build command execution started.
2025-06-19T15:14:38.835148928Z up to date, audited 6 packages in 2s
2025-06-19T15:14:38.836267869Z found 0 vulnerabilities
2025-06-19T15:14:39.269966767Z > main@1.0.0 build
2025-06-19T15:14:39.269972078Z > tsc
2025-06-19T15:14:39.275731379Z sh: tsc: Permission denied
2025-06-19T15:14:44.000000000Z Build archive was not created.
Should I make the function run sudo npm run build instead?
Weird...is there something weird with the folders you're deploying? Or maybe the path in the function settings isn't right?
Here's the function JSON from appwrite.json:
{
"$id": "main",
"name": "Main API",
"runtime": "node-22",
"specification": "s-0.5vcpu-512mb",
"execute": [
"any"
],
"events": [],
"scopes": [],
"schedule": "",
"timeout": 60,
"enabled": true,
"logging": true,
"entrypoint": "dist/main.js",
"commands": "npm install && npm run build",
"path": "functions/main"
}
And a screenshot of my directories:
I don't think it's an issue with the folders because it seems NPM parses package.json just fine.
If it helps, here's a copy of my source code (not quite ready to commit to git yet)
what if you delete your node_modules folder before deploying?
Yep, no longer getting that error.
Is there a way to have Appwrite ignore that directory (similar to a .gitignore)?
Having the modules installed locally is neccessary for code completion
Add a .gitignore file
https://github.com/digitalocean/doctl/issues/1632 seems the same issue to me and deleting node_modules also fixed it for me
Recommended threads
- All function deployments fail (node 18-2...
Error: bash: /usr/local/server/helpers/build-cache.sh: No such file or directory Sidecar error: Build archive was not created at /mnt/code/code.tar.gz Scope: ...
- Why does this happen?
`AppwriteException: general_argument_invalid, Invalid `secret` param: Value must be a valid string and at least 1 chars and no longer than 256 chars (400)` the...
- Selfhosted starter python function retur...
I am running a selfhosted appwrite instance. Creating a node function and executing it works just fine but when i try to execute a python starter function, i ge...