julia add VegaLite 遇到 gyp permission denied 的解决方式

报错内容

(@v1.5) pkg> add VegaLite

...
   Building VegaLite → `~/.julia/packages/VegaLite/sHyyT/deps/build.log`
┌ Error: Error building `VegaLite`:
│
│ > canvas@2.5.0 install /root/.julia/packages/VegaLite/sHyyT/deps/node_modules/canvas
│ > node-pre-gyp install --fallback-to-build
│
│ node-pre-gyp WARN Using request for node-pre-gyp https download
│ node-pre-gyp WARN Pre-built binaries not installable for canvas@2.5.0 and node@10.15.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
│ node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/root/.julia/packages/VegaLite/sHyyT/deps/node_modules/canvas/build'
│ gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/10.15.0"
│ gyp WARN EACCES attempting to reinstall using temporary dev dir "/root/.julia/packages/VegaLite/sHyyT/deps/node_modules/canvas/.node-gyp"
│ gyp WARN install got an error, rolling back install
│ gyp WARN install got an error, rolling back install
│ gyp ERR! configure error
│ gyp ERR! stack Error: EACCES: permission denied, mkdir '/root/.julia/packages/VegaLite/sHyyT/deps/node_modules/canvas/.node-gyp'
│ gyp ERR! System Linux 3.10.0-957.27.2.el7.x86_64
│ gyp ERR! command "/root/.julia/packages/NodeJS/rx0mH/deps/bin/node-v10.15.0-linux-x64/bin/node" "/root/.julia/packages/NodeJS/rx0mH/deps/bin/node-v10.15.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/root/.julia/packages/VegaLite/sHyyT/deps/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/root/.julia/packages/VegaLite/sHyyT/deps/node_modules/canvas/build/Release" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
│ gyp ERR! cwd /root/.julia/packages/VegaLite/sHyyT/deps/node_modules/canvas
│ gyp ERR! node -v v10.15.0
│ gyp ERR! node-gyp -v v3.8.0
│ gyp ERR! not ok
│ node-pre-gyp ERR! build error
│ node-pre-gyp ERR! stack Error: Failed to execute '/root/.julia/packages/NodeJS/rx0mH/deps/bin/node-v10.15.0-linux-x64/bin/node /root/.julia/packages/NodeJS/rx0mH/deps/bin/node-v10.15.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/root/.julia/packages/VegaLite/sHyyT/deps/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/root/.julia/packages/VegaLite/sHyyT/deps/node_modules/canvas/build/Release --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
│ node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/root/.julia/packages/VegaLite/sHyyT/deps/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
│ node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
│ node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
│ node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
│ node-pre-gyp ERR! System Linux 3.10.0-957.27.2.el7.x86_64
│ node-pre-gyp ERR! command "/root/.julia/packages/NodeJS/rx0mH/deps/bin/node-v10.15.0-linux-x64/bin/node" "/root/.julia/packages/VegaLite/sHyyT/deps/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
│ node-pre-gyp ERR! cwd /root/.julia/packages/VegaLite/sHyyT/deps/node_modules/canvas
│ node-pre-gyp ERR! node -v v10.15.0
│ node-pre-gyp ERR! node-pre-gyp -v v0.11.0
│ node-pre-gyp ERR! not ok
│ Failed to execute '/root/.julia/packages/NodeJS/rx0mH/deps/bin/node-v10.15.0-linux-x64/bin/node /root/.julia/packages/NodeJS/rx0mH/deps/bin/node-v10.15.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/root/.julia/packages/VegaLite/sHyyT/deps/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/root/.julia/packages/VegaLite/sHyyT/deps/node_modules/canvas/build/Release --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
│ npm ERR! code ELIFECYCLE
│ npm ERR! errno 1
│ npm ERR! canvas@2.5.0 install: `node-pre-gyp install --fallback-to-build`
│ npm ERR! Exit status 1
│ npm ERR!
│ npm ERR! Failed at the canvas@2.5.0 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/2020-10-08T09_35_32_795Z-debug.log
│ ERROR: LoadError: failed process: Process(setenv(`/root/.julia/packages/NodeJS/rx0mH/deps/bin/node-v10.15.0-linux-x64/bin/node /root/.julia/packages/NodeJS/rx0mH/deps/bin/node-v10.15.0-linux-x64/lib/node_modules/npm/bin/npm-cli.js install --scripts-prepend-node-path=true --production --no-package-lock --no-optional`; dir="/root/.julia/packages/VegaLite/sHyyT/deps"), ....
...
/buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:949

解决

可能是因为 npm 安装东西的过程中出现问题,因为VegaLite 是对 js 版本的封装,使用下面的代码解决:

# 在 cmd 中,手动 npm 安装以下内容
[root]# npm install --scripts-prepend-node-path=true --production --no-package-lock --no-optional~/.julia/dev/VegaLite/depsnpm

# 上述安装结束后,在 Julia pkg 模式下正常安装 VegaLite
(@v1.5) pkg> add VegaLite

参考:Error building VegaLite

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值