By Nick Moore
I have a node.js function set up, which works fine using the CLI to deploy to a development workspace. Now I’m trying to deploy it as part of an app. I push the code to GitHub and the build is triggered, but I get this:
[2023-03-09 16:39:12] ╭──────────── git repo clone ───────────╼
[2023-03-09 16:39:12] │ › fetching app source code
[2023-03-09 16:39:12] │ => Selecting branch "deploy"
[2023-03-09 16:39:13] │ => Checking out commit "c670dcbcdada6094f6bd002a0e5c7c3f1ab7139a"
[2023-03-09 16:39:13] │
[2023-03-09 16:39:13] │ ✔ cloned repo to /.app_platform_workspace
[2023-03-09 16:39:13] ╰────────────────────────────────────────╼
[2023-03-09 16:39:13]
[2023-03-09 16:39:13] › applying source directory functions
[2023-03-09 16:39:13] ✔ using workspace root /.app_platform_workspace/functions
[2023-03-09 16:39:13]
[2023-03-09 16:39:16] › validating project.yml configuration
[2023-03-09 16:39:17] ✔ project.yml is valid
[2023-03-09 16:39:17] › preparing build environment
[2023-03-09 16:39:18]
[2023-03-09 16:39:18] ╭──────────── project build ───────────╼
[2023-03-09 16:39:19] │ Started running npm install && npm run build in /.app_platform_workspace/functions/lib
[2023-03-09 16:39:19] │ /bin/bash: line 1: npm: command not found
[2023-03-09 16:39:19] │
[2023-03-09 16:39:19] │ › Error: 'npm install' exited with code 127
[2023-03-09 16:39:19] │
[2023-03-09 16:39:19] │ command exited with code 1
[2023-03-09 16:39:19] │
[2023-03-09 16:39:20] │ ✘ build failed
The remote build process seems unable to find its own npm binary. Any advice will be gratefully received.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
This is quite interesting, do you have your package.json file committed to your GitHub repository?
I’ve just tested this out with the following sample Node.js function and it seems to be picking up the Node and npm binaries as exepcted:
https://github.com/digitalocean/sample-functions-nodejs-qrcode
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.