Web3js
在 Ubuntu 16.04 上安裝 web3
我正在嘗試在 ubuntu 16.04 vm 上安裝 web3,但出現以下錯誤。
npm WARN deprecated fs-promise@2.0.3: Use mz or fs-extra^3.0 with Promise Support npm WARN deprecated tar.gz@1.0.7: ⚠️ WARNING ⚠️ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar > scrypt@6.0.3 preinstall /home/ltu/web3/node_modules/scrypt > node node-scrypt-preinstall.js > scrypt@6.0.3 install /home/ltu/web3/node_modules/scrypt > node-gyp rebuild gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/ltu/web3/node_modules/scrypt/build' gyp ERR! System Linux 4.13.0-38-generic gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/ltu/web3/node_modules/scrypt gyp ERR! node -v v9.10.1 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok npm WARN enoent ENOENT: no such file or directory, open '/home/ltu/web3/package.json' npm WARN web3 No description npm WARN web3 No repository field. npm WARN web3 No README data npm WARN web3 No license field. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! scrypt@6.0.3 install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the scrypt@6.0.3 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! /home/ltu/.npm/_logs/2018-04-20T10_50_03_804Z-debug.log
請幫忙!!!
你的權限
node_modules
是root。當您使用sudo
或以 root 身份全域安裝某些軟體包時,會發生這種情況。為了能夠立即安裝,您需要執行安裝命令sudo
sudo npm install web3 -g
如果使用 sudo 安裝包,下次安裝包時會出現“EACCES:權限被拒絕”錯誤,因為通過 sudo 安裝的包的所有者是 root,而不是你。
通過 yarn 安裝 web3.js:
$ 紗線添加 web3 –dev