CentOS上安装remix-ide错误及解决方法

remix-ide安装文档:https://github.com/ethereum/remix-ide

本机环境:

1
2
3
4
5
6
7
8
9
10
11
12
> 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

安装

1
> npm install remix-ide -g

启动

1
> remix-ide

然后报错了…,错误信息如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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目录

1
> ll /services/apps/node-v8.9.3-linux-x64/lib/node_modules/

确实没有scrypt

然后安装scrpt
scrpt文档 https://www.npmjs.com/package/scrypt
具体执行步骤:

1
2
> 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参数

1
> npm install --unsafe-perm --verbose -g node-gyp

安装完scrypt后,执行remix-ide仍然报错,继续探索,终于找到了解决方案
https://github.com/barrysteyn/node-scrypt/issues/108

具体执行

1
2
> cd /services/apps/node-v8.9.3-linux-x64/lib/node_modules/scrypt
> node-gyp configure build

编译成功

最后再执行remix-ide,完美,成功启动

JouyPub wechat
欢迎订阅「K叔区块链」 - 专注于区块链技术学习