在 Azure VM 上安装 Highcharts 导出服务器时 PhantomJS 出错 (Ubuntu 20.04)

Error with PhantomJS when installing Highcharts export server on Azure VM (Ubuntu 20.04)

我正在尝试在 Ubuntu 20.04 上 运行 的新 Azure VM 上安装 Highcharts 导出服务器。我已经安装了 node.js 和 npm,当我尝试 运行 npm install 命令时:

sudo npm install highcharts-export-server -g

我收到以下错误:

Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /usr/local/lib/node_modules/highcharts-export-server/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1634831384140/phantomjs-2.1.1-linux-x86_64 -> /usr/local/lib/node_modules/highcharts-export-server/node_modules/phantomjs-prebuilt/lib/phantom
Phantom installation failed { [Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1634831384140/phantomjs-2.1.1-linux-x86_64' -> '/usr/local/lib/node_modules/highcharts-export-server/node_modules/phantomjs-prebuilt/lib/phantom']
errno: -13,
code: 'EACCES',
syscall: 'link',
path:
'/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1634831384140/phantomjs-2.1.1-linux-x86_64',
dest:
'/usr/local/lib/node_modules/highcharts-export-server/node_modules/phantomjs-prebuilt/lib/phantom' } Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1634831384140/phantomjs-2.1.1-linux-x86_64' -> '/usr/local/lib/node_modules/highcharts-export-server/node_modules/phantomjs-prebuilt/lib/phantom'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt@2.1.14 install: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt@2.1.14 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-10-21T15_49_48_318Z-debug.log

截图如下:

我也试过使用这个命令单独安装 PhantomJS:

sudo npm install -g phantomjs@2.1.1 --unsafe-perm

(参见:Why can't I install phantomjs (Error: EACCES: permission denied)?) 那没有帮助。

我怎样才能克服这个错误并在我们的 VM 上安装 highcharts?

已通过将 NPM 和 nodejs 更新到最新版本修复