Can't install private npm registry in RedwoodJS project

Hello Folks,

I try to add Fontawesome Pro into the web workspace

I defined FONT_AWESOME_NPM_TOKEN in my zsh and it can be echo

and already configure the private registry token for npm & yarn within 3 places of .npmrc

  1. Home Directory (~/.npmrc) for global
  2. Root of RedwoodJS
  3. web/.npmrc for per-project setup also

This is all .npmrc content

@fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=${FONT_AWESOME_NPM_TOKEN}

And this is Terminal log

❯ yarn workspace web add @fortawesome/fontawesome-pro
➤ YN0027: @fortawesome/fontawesome-pro@unknown can't be resolved to a satisfying range
➤ YN0035: The remote server failed to provide the requested resource
➤ YN0035:   Response Code: 404 (Not Found)
➤ YN0035:   Request Method: GET
➤ YN0035:   Request URL: https://registry.yarnpkg.com/@fortawesome%2ffontawesome-pro

➤ Errors happened when preparing the environment required to run this command.

This is my deps versions

❯ yarn rw --version
1.1.1
❯ yarn -v
3.2.0
❯ node -v
v16.14.2
❯ npm -v
8.5.0
❯ npx -v
8.5.0

Thank you
Mike

Hi Mike, thanks for reaching out. Not :100: on if this will work for you as I can not test it, but I think moving the contents of .npmrc you listed and adapting them to .yarnrc.yml should fix your issue.

See: https://yarnpkg.com/configuration/yarnrc#npmRegistries

This is a yarn configuration issue and not related specifically to RedwoodJS. If the above tip does not work, I’d reach out to fontawesome’s support to see if they can update their documentation for yarn 3.

2 Likes

Thank you!, It solved

I added the npmScopes of FontAwesome private registry. Using URL and PRIVATE_TOKEN

This is my updated .yarnrc.yml

NOTE: $FONT_AWESOME_NPM_TOKEN is exported in zsh

compressionLevel: 0

enableGlobalCache: true

nmMode: hardlinks-local

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.2.0.cjs

npmScopes:
  fortawesome:
    npmRegistryServer: "https://npm.fontawesome.com/"
    npmAlwaysAuth: true
    npmAuthToken: ${FONT_AWESOME_NPM_TOKEN}
2 Likes