Installing Packages from external sources

I am struggling with installing packages from external parties such as MDB. I am currently getting

npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t https://myOauth@git.mdbootstrap.com/mdb/react/mdb5/prd/mdb5-react-ui-kit-pro-essential
npm ERR! remote: HTTP Basic: Access denied
npm ERR! fatal: Authentication failed for 'https://git.mdbootstrap.com/mdb/react/mdb5/prd/mdb5-react-ui-kit-pro-essential.git/'
npm ERR! 
npm ERR! exited with error code: 128

Is there anything I can do to get around this?

Hi there,

Thanks for reaching out.

It appears you may need to provide some authentication details in git to allow the private repo to be accessed. I’m not familiar with the MDB setup, and I’ve adapted this from a previous question around private repos from GitHub, which might get you up and running:

  1. Add your MDB_USER, MDB_PASSWORD to the service as environment variables

2. In the Build Command, reference those variables to set the git config in the build container:

git config --global url."https://${MDB_USER}:${MDB_PASSWORD}@git.mdbootstrap.com".insteadOf "https://git.mdbootstrap.com"

It might be worth creating a render_build.sh script in the root of your code to use as the Build Command, so that you can add this to any other steps required for your project setup.

Hope that helps

Alan

1 Like

Hey Alan,

I tried what you mentioned and I still seem to be getting the same error where it can’t read the username even after being set in the env vars.

Pasting a snippet for reference:

Apr 20 07:30:04 AM  ==> Running build command 'git config --global url."https://${MDB_USER}:${MDB_PASSWORD}@git.mdbootstrap.com".insteadOf "https://git.mdbootstrap.com" && yarn start'...
Apr 20 07:30:04 AM  yarn run v1.22.5
Apr 20 07:30:04 AM  $ yarn && cd ./platform/ && yarn && yarn build
Apr 20 07:30:05 AM  warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
Apr 20 07:30:05 AM  [1/4] Resolving packages...
Apr 20 07:30:05 AM  [2/4] Fetching packages...
Apr 20 07:30:05 AM  [3/4] Linking dependencies...
Apr 20 07:30:06 AM  [4/4] Building fresh packages...
Apr 20 07:30:07 AM  success Saved lockfile.
Apr 20 07:30:07 AM  warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
Apr 20 07:30:07 AM  [1/4] Resolving packages...
Apr 20 07:30:08 AM  [2/4] Fetching packages...
Apr 20 07:30:10 AM  error Command failed.
Apr 20 07:30:10 AM  Exit code: 128
Apr 20 07:30:10 AM  Command: git
Apr 20 07:30:10 AM  Arguments: ls-remote --tags --heads https://<myToken>@git.mdbootstrap.com/mdb/react/mdb5/prd/mdb5-react-ui-kit-pro-essential
Apr 20 07:30:10 AM  Directory: /opt/render/project/src/platform
Apr 20 07:30:10 AM  Output:
Apr 20 07:30:10 AM  fatal: could not read Username for 'https://git.mdbootstrap.com': terminal prompts disabled
Apr 20 07:30:10 AM  info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Apr 20 07:30:10 AM  error Command failed with exit code 128.
Apr 20 07:30:10 AM  info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Apr 20 07:30:10 AM  ==> Build failed 😞

Are there any other configuration settings that need set? I appreciate you reaching out and I will continue to play around but currently no luck! Also, should this be asking for user and pass since we have an access token? Maybe I need to disable that somehow.

Hi there,

Looking a little further at the MDB docs, it appears it would be expecting basic auth credentials, which would have been stored when installing into the package.json, is this what you already have? If so, that shouldn’t require any further git config as per my previous suggestion and can be removed.

Are you able run yarn install in the shell? Maybe with the --verbose option to see if that sheds any more light? It’s looking like the issue may be raised from the ./platform/package.json?

Maybe it’s also worth tidying up the lock files as the warnings suggest, even if it’s just to clean up those build logs.

Please let us know if we can assist any further.

Alan

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.