Cannot publish NPM package: env: ‘to’: No such file or directory

I am trying to publish a simple NPM package: https://github.com/pojntfx/mather.js

When trying to deploy the package to NPM however, the following error arises:

2.34s
dpl.1

Installing deploy dependencies

Fetching: dpl-npm-1.10.13.gem (100%)

Successfully installed dpl-npm-1.10.13

1 gem installed

dpl.2

Preparing deploy

NPM version: 6.12.0

Authenticated with email felix@pojtinger.com and API key ****************ypt]

dpl.3

Deploying application

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: 48

env: ‘to’: No such file or directory

Done. Your build exited with 0.

Running npm run build && npm publish locally works.

This is the job: https://travis-ci.com/pojntfx/mather.js/jobs/254952030

Did it ever work? If so, please point to a successful deployment.

No, sadly it didn’t. I basically did a clean travis setup npm, and it didn’t work.

The error must be happening at https://github.com/travis-ci/dpl/blob/v1.10.13/lib/dpl/provider/npm.rb#L33. Judging by the error message, NPM_API_KEY=#{option(:api_key)} has spaces and “to” is the word after the first space.

2 Likes

The weird error message is thus due to not sanitizing shell input. Normally, it would rather say something like “invalid API key”.

1 Like

@native-api Thank you so much for your help! I simply forgot to add the --pro flag when I used the travis setup npm command. Here is a working build now: https://travis-ci.com/pojntfx/mather.js/jobs/255261805