Deployment to npm fails with node 20

In an attempt to deploy to npm with Node 20 (which also happens to be the latest LTS version), I’m getting the following error message:

NPM version: 10.1.0
Authenticated with email [secure] and API key ****************wxwZ
Cleaning up git repository with `git stash --all`. If you need build artifacts for deployment, set `deploy.skip_cleanup: true`. See https://docs.travis-ci.com/user/deployment#Uploading-Files-and-skip_cleanup.
Saved working directory and index state WIP on (no branch): e90d5e5 fix: use --import for node 20
NPM API key format changed recently. If your deployment fails, check your API key in ~/.npmrc.
http://docs.travis-ci.com/user/deployment/npm/
~/.npmrc size: 52
dpl.3
Deploying application
npm ERR! code ERR_INVALID_AUTH
npm ERR! Invalid auth configuration found: `_auth` must be renamed to `//registry.npmjs.org/:_auth` in user config
npm ERR! Please run `npm config fix` to repair your configuration.`

When I specify to run deployment with node 18 instead, everything seems to work fine. It appears that dpl does not translate the info in .travis.yml into .npmrc correctly. How do I fix this?

Here are the full logs of the two builds:

Hi @andreashuber69,

I will be looking into this, hopefully I can get an answer to you soon - I need to do some testing, and try to repro the issue at hand.

1 Like

Hi @andreashuber69,

Try using edge: true in deploy phase, this utilizes dpl v2:

deploy:
  provider: npm
  edge: true
  email:
    secure: IEn1OCyjNVNyCriX5mVZVCkLYpGAzcenMSGbxMZyhUsNTRr4btDHEJQIU588IcYJBO460QBUPO8QzVBCCma1//szpvtbXXdXCizB3/gFHKJSxOyvgSUN2FkoaKbu8IWmpiytu2YafHKxbBpwTTxujew7jupClZhiT1PsXRFpQnUGnzwKp06N81G6TFhNkdOkPCk1DzzytLSXhakeUEuJBgMDpD1qIHe9DYqP4TibTxdJa69BbdzUBt8Qw8+cjD2AvUfb5GGkbSV4ekuBHWzBqld96uNeKoMeJ5AZCfUEA4h20GvLjLwmh7cichggoJX4cdu8EYYKwnt5jogyIdFspa8xrtYRYtXG74oBs9N/QX2mzSvT8Qj7/ShMgHd6mCjfIFGxfmpGoPRFVJWgP61MqyAjRtA5qkwvf/0HazNPQShp7eFoqTjcbO8tmK07AXQHAn/JjEz3Dl/D1NayFHZGk63VxPn8I7ttf1lC0jV+viLrYCNclvxVCXXML8iHb6s5sHvOKeKlr0kUEKyaLMwqKAVpKWF0rE0GeizqYLsmbV+OdUUirbXgP3VujqpqlE6NIIGsIoOAgGpa78L1/RDYAThyCpNnx56CLGF2MCylSOUSIDiNe+qb46KrtlwpDJ4krp17Ot8+Y088GNdZklYEaHDv0sPthcULXOqyT5+PeCs=
  api_token:
    secure: hnEhGSL0cgc3l12peUzlisWFjthU99OyCjJL2o6zc+r+6IOvFvxCehq2WL7rYksR9W5/xbVODGpo05A/QZGtO9cJPsRcMzCZ4VCB8Cg3vkFpSWURe1IAHGZUx9UOAv+gdZ+WEAZMzqNFGYedlLM73aBUbiRWDdLY7WDJ1Gp4mPLfqJF/26UVWzPSohoJUmW8QGCr8+WSWDTUvHYEuKjntQI+EtZ3ZSQeLIgV97eeNem1GFBDYYnhHSp4Lhx/WFTPpvxh5KmUI2x1z2nytwDS5dW9RneczXPf6LGgOzbvZ3DP4KeaSI6rkL1JkJbLMZrl1FGwHlVeXqMVAuxlGyLpDwkoISQ3w9VrPvBvAwgyX4hQjCYvGR2xlYiQcWkqmTeAvstZbhf7xfMmUSn87Nr4kStFMO0Lr/kc2DpjyTG4De9cU2zc2hlRQxPXV62o/H3sXpw9OswR4wy0PIEU2p5XRrdNaVX0NI4tuaiTFpwV+M91AGZraX1Uc9ZfUbqACeLd8qTASzYqvbSKVjxDTuLq8fVzPx18EQNdYUbzxxsRj982QUeOV4Kj7OYIvGjRscos5H5yx0VDpRR4QU47xAD6UrBZj1NtVyupKZ0nkZSzCVRRmH7RKeH/pwkZM+gQVqEWAHIsAmtzQsvdqn2RiUxMdwX7e76X0vSRZIw/Gk0btTE=
  on:
    branch: master

Hi @Montana

Thanks for your suggestion. I get a slightly different error message:

$ npm publish .
npm ERR! code ERR_INVALID_AUTH
npm ERR! Invalid auth configuration found: `_auth` must be renamed to `//registry.npmjs.org/:_auth` in user config
npm ERR! Please run `npm config fix` to repair your configuration.`
npm ERR! A complete log of this run can be found in: /home/travis/.npm/_logs/2023-10-26T19_23_35_639Z-debug-0.log
Failed to publish
failed to deploy

Full log: Travis CI - Test and Deploy with Confidence

Hi @Montana

I guess this can’t be fixed quickly. Before I implement a workaround for all my repos, do you have an estimation how long this will take?

Thanks,

Andreas

Hi @andreashuber69,

I will internally bring this up and see if I can get a better ETA.

1 Like

Hi @Montana

With node 18.19 (released 29th of November), I’m getting the same errors as with LTS (20.10), so now deployment also fails with the latest 18 release. It would be nice if this issue could get a higher priority.

Thanks,

Andreas

Hi @andreashuber69,

before_deploy:
  - npm install -g npm@9

Should solve this. Please let me know.

2 Likes

Hi @Montana

Thank you, this works flawlessly.

Cheers,

Andreas

Hi @andreashuber69,

Really great to hear. I’m glad I could solve your issue.

@Montana that sounds like a weird “solution”. Just downgrading npm feels more like avoiding to solve the actual issue here. The message tells you what to do. Change the .npmrc to not have _auth=… but instead the suggested syntax. Or is there something Travis specific I’m missing here?

1 Like

Agreed, this is a temporary workaround. Hopefully Travis CI can fix this soon.