Reputation: 1213
I'm calling npm publish
from a server code and it doesn't know how authenticate:
npm ERR! need auth auth and email required for publishing
npm ERR! need auth You need to authorize this machine using `npm adduser`
The server is in Python and is run by uwsgi. The exact same code runs successfully if called manually from shell, and the server is running under the same user but doesn't seem to pick up stored credentials. Also, I can't run npm adduser
from a server as it requires interaction.
Any ideas how to work around that?
Upvotes: 1
Views: 466
Reputation: 1213
The server running under uwsgi doesn't see environment variables available in the shell. One of them is $HOME which is what npm needs to know to find auth credentials. For now I solved the problem by explicitly setting $HOME in the uwsgi config.
Thanks to Alexey Ten for setting in me in the right direction!
Upvotes: 2