I have a digital ocean app that connected with the.master branch, when I deploy to the server I have the below error, the error is appear suddenly. I have another app that connected with the same repo but for the branch staging, this work wells , and there is no build errors, both branches are same of the code.
─────────── app build ───────────╼
[2023-09-19 12:31:36] │ ---> Node.js Buildpack
[2023-09-19 12:31:36] │ ---> Installing toolbox
[2023-09-19 12:31:36] │ ---> - jq
[2023-09-19 12:31:37] │ ---> - yj
[2023-09-19 12:31:37] │ ---> Getting Node version
[2023-09-19 12:31:37] │ ---> Resolving Node version
[2023-09-19 12:31:39] │ ---> Downloading and extracting Node v16.20.2
[2023-09-19 12:31:43] │ ---> Parsing package.json
[2023-09-19 12:31:44] │ ---> No file to start server
[2023-09-19 12:31:44] │ ---> either use 'docker run' to start container or add index.js or server.js
[2023-09-19 12:31:44] │ Project contains package-lock.json, using npm
[2023-09-19 12:31:48] │ Using npm v8.19.4. To configure a different version of npm, set the engines.npm property in package.json.
[2023-09-19 12:31:48] │ See https://do.co/apps-buildpack-node for further instructions.
[2023-09-19 12:31:48] │ Installing node_modules using npm (from package-lock.json)
[2023-09-19 12:31:48] │ Running npm ci
[2023-09-19 12:31:48] │
[2023-09-19 12:32:12] │ npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
[2023-09-19 12:32:13] │ npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
[2023-09-19 12:32:25] │
[2023-09-19 12:32:25] │ > project@1.0.0 prepare
[2023-09-19 12:32:25] │ > husky install
[2023-09-19 12:32:25] │
[2023-09-19 12:32:25] │ sh: 1: husky: not found
[2023-09-19 12:32:25] │ npm notice
[2023-09-19 12:32:25] │ npm notice New major version of npm available! 8.19.4 -> 10.1.0
[2023-09-19 12:32:25] │ npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.1.0>
[2023-09-19 12:32:25] │ npm notice Run `npm install -g npm@10.1.0` to update!
[2023-09-19 12:32:25] │ npm notice
[2023-09-19 12:32:25] │ npm ERR! code 127
[2023-09-19 12:32:25] │ npm ERR! path /workspace
[2023-09-19 12:32:25] │ npm ERR! command failed
[2023-09-19 12:32:25] │ npm ERR! command sh -c -- husky install
[2023-09-19 12:32:25] │
[2023-09-19 12:32:25] │ npm ERR! A complete log of this run can be found in:
[2023-09-19 12:32:25] │ npm ERR! /home/apps/.npm/_logs/2023-09-19T12_31_48_953Z-debug-0.log
[2023-09-19 12:32:25] │
[2023-09-19 12:32:25] │ unable to invoke layer creator
[2023-09-19 12:32:25] │ installing node_modules: exit status 127
[2023-09-19 12:32:25] │ ERROR: failed to build: exit status 1
[2023-09-19 12:32:25] │
[2023-09-19 12:32:25] │
[2023-09-19 12:32:25] │ For documentation on the buildpacks used to build your app, please see:
[2023-09-19 12:32:25] │
[2023-09-19 12:32:25] │ Node.js v0.3.6 https://do.co/apps-buildpack-node
[2023-09-19 12:32:25] │
[2023-09-19 12:32:25] │ ✘ build failed
[]
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!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hi there,
The build error you are facing is due to
husky
not being found when theprepare
script is running:I could suggest a few things to try:
Make sure
husky
is listed as a dependency in yourpackage.json
file. If it’s missing, you need to add it:On your local environment, try deleting both the
node_moduels
directory and thepackage-lock-json
file and the reinstall:After this, commit the changes and try deploying again.
Usually
husky
is used for Git hooks, which should not be necessary in a production build. If you don’t needhusky
to run on your DigitalOcean App Platform deployment, you can adjust theprepare
script or remove it from thepackage.json
so that it is not executed on the App Platform.Let me know how it goes!
Best,
Bobby