IBM-Blockchain-Archive / fabric-boilerplate

Get up and running quickly with your own blockchain application!
Apache License 2.0
79 stars 150 forks source link

npm start failing #8

Closed KennethNagin closed 7 years ago

KennethNagin commented 7 years ago

I am trying use the fabric-boilerplate. I followed your instructions up to the npm start, but it fails. The fabric docker instances seem to be running properly: nagin@rcc-hrl-kvg-558:~/work/src/github.com/fabric-boilerplate$ sudo docker ps [sudo] password for nagin: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8fbb050f8977 rikmoedt/fabric-peer:0.5-dp "sh -c 'sleep 5; peer" 25 minutes ago Up 25 minutes fabricboilerplate_vp1_1 567c1144a10f rikmoedt/fabric-peer:0.5-dp "sh -c 'sleep 5; peer" 25 minutes ago Up 25 minutes 0.0.0.0:7050-7051->7050-7051/tcp fabricboilerplate_vp0_1 561b339f7fb7 rikmoedt/fabric-membersrvc:0.5-dp "membersrvc" 25 minutes ago Up 25 minutes 0.0.0.0:7054->7054/tcp fabricboilerplate_membersrvc_1

However the npm start fails:

nagin@rcc-hrl-kvg-558:~/work/src/github.com/fabric-boilerplate$ sudo npm start

server@0.0.0 start /home/nagin/work/src/github.com/fabric-boilerplate npm run build-css | npm run watch-css | npm run nodemon

server@0.0.0 nodemon /home/nagin/work/src/github.com/fabric-boilerplate GOPATH=$(pwd) nodemon ./bin/www

sh: 1: node-sass: not found

sh: 1: node-sass: not found

sh: 1: nodemon: not found

npm ERR! Linux 3.19.0-25-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "nodemon" npm npmERR! node v7.1.0 npm ERR! npm v3.10.9 npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! npmerrno ENOENT

There many many npm ERR messages after that.

What do you suggest?

--Ken

AlbertHristov commented 7 years ago

have you tried npm install ?

KennethNagin commented 7 years ago

npm install also fails: npm ERR! Linux 3.19.0-25-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" npm ERR! node v7.1.0 npm ERR! npm v3.10.9 npm ERR! code ELIFECYCLE

npm ERR! grpc@0.13.2-pre1 install: node-pre-gyp install --fallback-to-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the grpc@0.13.2-pre1 install script 'node-pre-gyp install --fallback-to-build'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the grpc package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-pre-gyp install --fallback-to-build npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs grpc npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls grpc npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /home/nagin/work/src/github.com/fabric-boilerplate/npm-debug.log

KennethNagin commented 7 years ago

sudo npm install has a different error: ../src/node/ext/byte_buffer.cc: In function \u2018v8::Localv8::Value grpc::node::MakeFastBuffer(v8::Localv8::Value)\u2019: ../src/node/ext/bytebuffer.cc:100:72: warning: \u2018v8::Localv8::Object v8::Function::NewInstance(int, v8::Localv8::Value) const\u2019 is deprecated (declared at /home/nagin/.node-gyp/7.1.0/include/node/v8.h:3287): Use maybe version [-Wdeprecated-declarations] Local fastBuffer = bufferConstructor->NewInstance(3, consArgs); ^ CXX(target) Release/obj.target/grpc_node/src/node/ext/call.o ../src/node/ext/call.cc: In static member function \u2018static Nan::NAN_METHOD_RETURN_TYPE grpc::node::Call::New(Nan::NAN_METHOD_ARGSTYPE)\u2019: ../src/node/ext/call.cc:616:20: error: \u2018class v8::Object\u2019 has no member named \u2018SetHiddenValue\u2019 info.This()->SetHiddenValue(Nan::New("channel").ToLocalChecked(), ^ ../src/node/ext/call.cc:625:19: warning: \u2018v8::Localv8::Object v8::Function::NewInstance(int, v8::Localv8::Value_) const\u2019 is deprecated (declared at /home/nagin/.node-gyp/7.1.0/include/node/v8.h:3287): Use maybe version [-Wdeprecated-declarations] argc, argv); ^ make: *\ [Release/obj.target/grpc_node/src/node/ext/call.o] Error 1 make: Leaving directory /home/nagin/work/src/github.com/fabric-boilerplate/node_modules/grpc/build' gyp ERR! build error gyp ERR! stack Error:make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/nagin/work/src/github.com/fabric-boilerplate/node_modules/node-gyp/lib/build.js:276:23) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:191:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12) gyp ERR! System Linux 3.19.0-25-generic gyp ERR! command "/usr/bin/nodejs" "/home/nagin/work/src/github.com/fabric-boilerplate

KennethNagin commented 7 years ago

I'm not sure that this is relevant but the last error is: npm ERR! grpc@0.13.2-pre1 install: node-pre-gyp install --fallback-to-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the grpc@0.13.2-pre1 install script 'node-pre-gyp install --fallback-to-build'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the grpc package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-pre-gyp install --fallback-to-build

AlbertHristov commented 7 years ago

What are the versions of node and npm?

KennethNagin commented 7 years ago

$ npm -version 3.10.9 $ nodejs -v v7.1.0

AlbertHristov commented 7 years ago

$ node -v v6.9.1 $ npm -version 3.10.8

Try installing those versions, I had troubles with nodejs >7

masterDev1985 commented 7 years ago

I think a few of these issues could be resolved by updating the version of hfc that is being used. grpc, which is an hfc dependency, is a real pain to get to build in 0.13.2. Newer versions of hfc use an updated version of this package. This demo's hfc version should be bumped to 0.5.4 if the intent is to keep running against v0.5 fabric networks, or 0.6.5 if the demo is going to be used against bluemix or the newer docker compose offering.

masterDev1985 commented 7 years ago

Here is the docker-compose offering that I was talking about:

https://github.com/IBM-Blockchain/fabric-images

KennethNagin commented 7 years ago

I will take a look at the hfc and docker-compose next week. For now this is update do downgrading node and npm: I install node v6.9.1 and npm 3.10.8 but it was not easy since apt-get does not support these versions. Instead I had to get a tarball for node and use npm to downgrade itself. I add this info since it might be the source of the problem. With the version change sudo npm install but unfortunately sudo npm start fails.

Details are list below:

$tar -xvf node-v6.9.1-linux-x64.tar.xz copied node to /usr/bin $sudo npm install -g npm@3.1 $ sudo npm -v 3.10.8 nagin@rcc-hrl-kvg-558:~/work/src/github.com/fabric-boilerplate$ sudo node -v v6.9.1 nagin@rcc-hrl-kvg-558:~/work/src/github.com/fabric-boilerplate$ sudo npm install npm WARN lifecycle server@0.0.0~postinstall: cannot run in wd %s %s (wd=%s) server@0.0

nagin@rcc-hrl-kvg-558:~/work/src/github.com/fabric-boilerplate$ npm start

server@0.0.0 start /home/nagin/work/src/github.com/fabric-boilerplate npm run build-css | npm run watch-css | npm run nodemon

server@0.0.0 nodemon /home/nagin/work/src/github.com/fabric-boilerplate GOPATH=$(pwd) nodemon ./bin/www

sh: 1: nodemon: not found

npm ERR! Linux 3.19.0-25-generic npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "nodemon" npm ERR! node v6.9.1 npm ERR! npm v3.10.8 npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! server@0.0.0 nodemon: GOPATH=$(pwd) nodemon ./bin/www npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the server@0.0.0 nodemon script 'GOPATH=$(pwd) nodemon ./bin/www'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the server package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! GOPATH=$(pwd) nodemon ./bin/www

many many error methods follow.

czar0 commented 7 years ago

Hi @KennethNagin, some ideas which come out from your logs:

  1. It seems both nodemon and node-sass are not installed. They are dependecies that should be installed globally (npm install -g nodemon node-sass)
  2. Please use a node version < 7.x
  3. Be sure you have all you need to compile native addons with node-gyp
  4. It is possible you would need to change permissions to the folder /usr/local/lib/node_modules in order to give access to your no-root user (sudo chown -R $(whoami) /usr/local/lib/node_modules)
  5. It is a good idea to use hfc 0.5.4. You can checkout the new branch ng1 which contains some additional features (see the complete commit message), updated readme and some fixes (including hfc 0.5.4)
andrewferrier commented 7 years ago

I have the same issue. npm install nodemon fixes it. It looks like nodemon is missing from package.json.

KennethNagin commented 7 years ago

npm install nodemon seems to fix the problem.