Question

problem with install dependency over ssh connection

Posted September 10, 2021 70 views
DeploymentReact

I was following this tutorial (https://www.digitalocean.com/community/tutorials/how-to-deploy-a-react-application-to-digitalocean-app-platform)

I connected my github account successfully. When I hit create button at the end of setup pages, everything looks normal.

However I get the error below when building:

[case-app-ui] [2021-09-10 06:28:43] => Initializing build
[case-app-ui] [2021-09-10 06:28:43] => Retrieving source code to /workspace
[case-app-ui] [2021-09-10 06:28:43] => Selecting branch "main"
[case-app-ui] [2021-09-10 06:28:44] => Checking out commit "515e23996c1aab4ac535a83d84e90d47948fdf47"
[case-app-ui] [2021-09-10 06:28:45] => Got source_dir: /
[case-app-ui] [2021-09-10 06:28:45] => Using workspace root /workspace
[case-app-ui] [2021-09-10 06:28:45] 
[case-app-ui] [2021-09-10 06:28:45] => Building app using buildpacks
[case-app-ui] [2021-09-10 06:28:45] => Configuring custom build command to be run at the end of the build:
[case-app-ui] [2021-09-10 06:28:45]      npm run build
[case-app-ui] [2021-09-10 06:28:46] => Running buildpack detection
[case-app-ui] [2021-09-10 06:28:46] 
[case-app-ui] [2021-09-10 06:28:46] heroku/nodejs-engine  0.5.0
[case-app-ui] [2021-09-10 06:28:46] digitalocean/node     0.3.4
[case-app-ui] [2021-09-10 06:28:46] digitalocean/procfile 0.0.3
[case-app-ui] [2021-09-10 06:28:46] digitalocean/custom   0.1.0
[case-app-ui] [2021-09-10 06:28:46] 
[case-app-ui] [2021-09-10 06:28:46] For documentation on the buildpacks used to build your app, please see:
[case-app-ui] [2021-09-10 06:28:46]    Node.js: https://do.co/apps-buildpack-node
[case-app-ui] [2021-09-10 06:28:47] 
[case-app-ui] [2021-09-10 06:28:47] => Building app
[case-app-ui] [2021-09-10 06:28:47] 
[case-app-ui] [2021-09-10 06:28:47] ---> Node.js Buildpack
[case-app-ui] [2021-09-10 06:28:47] ---> Installing toolbox
[case-app-ui] [2021-09-10 06:28:47] ---> - jq
[case-app-ui] [2021-09-10 06:28:47] ---> - yj
[case-app-ui] [2021-09-10 06:28:47] ---> Getting Node version
[case-app-ui] [2021-09-10 06:28:47] ---> Resolving Node version
[case-app-ui] [2021-09-10 06:28:49] ---> Downloading and extracting Node v12.22.6
[case-app-ui] [2021-09-10 06:29:03] ---> Parsing package.json
[case-app-ui] [2021-09-10 06:29:04] ---> No file to start server
[case-app-ui] [2021-09-10 06:29:04] ---> either use 'docker run' to start container or add index.js or server.js
[case-app-ui] [2021-09-10 06:29:04] Project contains package-lock.json, using npm
[case-app-ui] [2021-09-10 06:29:05] Using npm v6.14.15. To configure a different version of npm, set the engines.npm property in package.json.
[case-app-ui] [2021-09-10 06:29:05]   See https://do.co/apps-buildpack-node for further instructions.
[case-app-ui] [2021-09-10 06:29:05] Installing node_modules using npm (from package-lock.json)
[case-app-ui] [2021-09-10 06:29:05] Running npm ci
[case-app-ui] [2021-09-10 06:29:05] 
[case-app-ui] [2021-09-10 06:29:09] npm ERR! Error while executing:
[case-app-ui] [2021-09-10 06:29:09] npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/themicon/flot.git
[case-app-ui] [2021-09-10 06:29:09] npm ERR! 
[case-app-ui] [2021-09-10 06:29:09] npm ERR! Warning: Permanently added the RSA host key for IP address '140.82.121.3' to the list of known hosts.
[case-app-ui] [2021-09-10 06:29:09] npm ERR! git@github.com: Permission denied (publickey).
[case-app-ui] [2021-09-10 06:29:09] npm ERR! fatal: Could not read from remote repository.
[case-app-ui] [2021-09-10 06:29:09] npm ERR! 
[case-app-ui] [2021-09-10 06:29:09] npm ERR! Please make sure you have the correct access rights
[case-app-ui] [2021-09-10 06:29:09] npm ERR! and the repository exists.
[case-app-ui] [2021-09-10 06:29:09] npm ERR! 
[case-app-ui] [2021-09-10 06:29:09] npm ERR! exited with error code: 128
[case-app-ui] [2021-09-10 06:29:56] 
[case-app-ui] [2021-09-10 06:29:56] npm ERR! A complete log of this run can be found in:
[case-app-ui] [2021-09-10 06:29:56] npm ERR!     /home/apps/.npm/_logs/2021-09-10T06_29_09_253Z-debug.log
[case-app-ui] [2021-09-10 06:29:56] 
[case-app-ui] [2021-09-10 06:29:56] unable to invoke layer creator
[case-app-ui] [2021-09-10 06:29:56] installing node_modules: exit status 1
[case-app-ui] [2021-09-10 06:29:56] ERROR: failed to build: exit status 1
[case-app-ui] [2021-09-10 06:30:01] 
[case-app-ui] [2021-09-10 06:30:01] For documentation on the buildpacks used to build your app, please see:
[case-app-ui] [2021-09-10 06:30:01]    Node.js: https://do.co/apps-buildpack-node
[case-app-ui] [2021-09-10 06:30:01] 
[case-app-ui] [2021-09-10 06:30:01]  ! Build failed (145)

I don’t have a problem to running ‘npm ci’ on my local environment.
why am I getting this error? how can I solve this issue?

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.

×
Submit an Answer
1 answer

Hi @jamesdesouza

It looks like you are referencing a Git repo in your package.json. This is fine, but the problem is that it’s trying to clone it using SSH. GitHub requires a valid SSH key to clone a repo via SSH, but App Platform builds do not have that available. The reason this works locally is because you do have an SSH key configured that is also associated with your GitHub account.

The repo github.com/themicon/flot is public so you can instruct NPM to clone it via HTTPS instead of SSH like so:

package.json
"dependencies" : {
  "flot": "git+https://github.com/themicon/flot.git",
  ...
}