remix-ide安装文档:https://github.com/ethereum/remix-ide
本机环境:
> lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.4.1708 (Core)
Release: 7.4.1708
Codename: Core
> node --version
v8.9.3
> npm --version
6.1.0
安装
> npm install remix-ide -g
启动
> remix-ide
然后报错了...,错误信息如下:
Error: Cannot find module './build/Release/scrypt'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/services/apps/node-v8.9.3-linux-x64/lib/node_modules/remix-ide/node_modules/scrypt/index.js:3:20)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/services/apps/node-v8.9.3-linux-x64/lib/node_modules/remix-ide/node_modules/scrypt.js/node.js:1:76)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/services/apps/node-v8.9.3-linux-x64/lib/node_modules/remix-ide/node_modules/web3-eth-accounts/src/index.js:35:16)
at Module._compile (module.js:635:30)
看异常信息,应该是缺少scrypt包,检查系统node_modules目录
ll /services/apps/node-v8.9.3-linux-x64/lib/node_modules/
确实没有scrypt
然后安装scrpt
scrpt文档 https://www.npmjs.com/package/scrypt
具体执行步骤:
> npm install -g node-gyp
> npm install -g scrypt
在安装node-gyp时,又报了一个错误:WARN EACCES user “root” does not have permission to access the dev dir
解决方案:https://github.com/nodejs/node-gyp/issues/454
具体解决办法就是安装时加上--unsafe-perm
参数
npm install --unsafe-perm --verbose -g node-gyp
安装完scrypt后,执行remix-ide
仍然报错,继续探索,终于找到了解决方案
https://github.com/barrysteyn/node-scrypt/issues/108
具体执行
cd /services/apps/node-v8.9.3-linux-x64/lib/node_modules/scrypt
node-gyp configure build
编译成功
最后再执行remix-ide
,完美,成功启动