CounterpartyXCP / counterwallet

Counterparty web wallet
https://counterwallet.io
147 stars 162 forks source link

Can't build the docker image. #825

Closed cryptcoin-junkey closed 6 years ago

cryptcoin-junkey commented 6 years ago

I tried to build the Docker image and got the error like this.

Step 39/48 : RUN npm install -g bower grunt mocha-phantomjs
 ---> Running in 0079ff913b10
npm WARN deprecated npmconf@0.0.24: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/usr/bin/bower -> /usr/lib/node_modules/bower/bin/bower
/usr/bin/grunt -> /usr/lib/node_modules/grunt/bin/grunt
/usr/bin/mocha-phantomjs -> /usr/lib/node_modules/mocha-phantomjs/bin/mocha-phantomjs

> phantomjs@1.9.7-15 install /usr/lib/node_modules/mocha-phantomjs/node_modules/phantomjs
> node install.js

invalid configloglevel="notice"
/usr/lib/node_modules/mocha-phantomjs/node_modules/phantomjs/phantomjs is not writable: EACCES: permission denied, mkdir '/usr/lib/node_modules/mocha-phantomjs/node_modules/phantomjs/phantomjs'
Downloading http://cnpmjs.org/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-1.9.7-linux-x86_64.tar.bz2
Receiving...

Received 12852K total.
Extracting tar contents (via spawned process)
Copying extracted folder /tmp/phantomjs/phantomjs-1.9.7-linux-x86_64.tar.bz2-extract-1506145596829/phantomjs-1.9.7-linux-x86_64 -> /usr/lib/node_modules/mocha-phantomjs/node_modules/phantomjs/lib/phantom
Phantom installation failed [ { [Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/mocha-phantomjs/node_modules/phantomjs/lib/phantom']
    errno: -13,
    code: 'EACCES',
    syscall: 'mkdir',
    path: '/usr/lib/node_modules/mocha-phantomjs/node_modules/phantomjs/lib/phantom' } ] undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs@1.9.7-15 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the phantomjs@1.9.7-15 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/2017-09-23T05_46_39_563Z-debug.log
The command '/bin/sh -c npm install -g bower grunt mocha-phantomjs' returned a non-zero code: 1
jdogresorg commented 6 years ago

EACCES errors typically mean that you do not have the permissions to create the directory/file... that is what it looks like here. Phantom installation failed [ { [Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/mocha-phantomjs/node_modules/phantomjs/lib/phantom']

This does not look to be an issue with counterwallet.

cryptcoin-junkey commented 6 years ago

It looks the issue is caused by https://github.com/Medium/phantomjs/issues/707.

So the way to fix is two. Installng npm < 5.x or adding --unsafe-perm to npm install mocha-phantomjs. Which is better?

cryptcoin-junkey commented 6 years ago

@jdogresorg Yes. It is not Counterwallet itself. But Dockerfile in this repo.

cryptcoin-junkey commented 6 years ago

It causes the another problem just by adding --unsafe-perm (grunt didn't work. I don't know why).

So it should be like this.

diff --git a/Dockerfile b/Dockerfile
index 1932f1b..8c9c06d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -77,7 +77,7 @@ COPY . /counterwallet
 RUN rm -rf /counterwallet/build
 WORKDIR /counterwallet
 RUN git rev-parse HEAD
-RUN npm -g install npm@latest
+RUN npm -g install npm@4
 RUN npm config set strict-ssl false
 ENV PHANTOMJS_CDNURL="http://cnpmjs.org/downloads"
 RUN npm install -g bower grunt mocha-phantomjs
unsystemizer commented 6 years ago

@cryptcoin-junkey do you want to create a PR for this?

cryptcoin-junkey commented 6 years ago

@unsystemizer Of course I'll create a PR if my suspect was reasonable. This issue is a tether which is the best way to fix.

cryptcoin-junkey commented 6 years ago

I close this since this issue was fixed by 4e26454. Thanks @deweller