Issue
i have a cron
that compare the version of an npm package
installed on the server with the latest version on my private registry (verdaccio
) and update the package accordingly
REMOTE_VERSION=$(npm show ${PACKAGE_NAME} version)
LOCAL_VERSION=$(node -pe "require('./package.json').version")
...
This cron run without problem on all of my servers except for one where the command npm show ${PACKAGE_NAME} version
throws the error:
npm ERR! code ERR_STRING_TOO_LONG
npm ERR! Cannot create a string longer than 0x1fffffe8 characters
I have read here that 0x1fffffe8 is exactly 512MB, but the response of that command is just 4/5 chars (like "v0.1.50"), so it seems strange that it can exceed that limit. Moreover the same command (for the same package) run smoothly in local and all other servers
Here are some specs. of the server
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
Node v14.17.3
npm v6.14.13
nvm v0.38.0
pm2 v5.1.0
Solution
Upgrading to node 16.18.0
solve the issue.
Answered By - fasenderos Answer Checked By - Candace Johnson (WPSolving Volunteer)