composer rest server fails to start after upgrade

2019-08-29 05:01发布

问题:

docker logs -f rest shows the following

[2018-05-28 06:38:39] PM2 log: Launching in no daemon mode
[2018-05-28 06:38:39] PM2 log: Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
[2018-05-28 06:38:39] PM2 log: App name:composer-rest-server id:0 online
{ Error: Cannot find module 'base64-js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:7:11309)
    at t (/home/composer/node_modules/swagger-client/dist/index.js:1:177)
    at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:7:7)
    at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:7:11111)
    at t (/home/composer/node_modules/swagger-client/dist/index.js:1:177)
    at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:1:48717)
    at t (/home/composer/node_modules/swagger-client/dist/index.js:1:177)
    at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:1:40420)
    at t (/home/composer/node_modules/swagger-client/dist/index.js:1:177)
    at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:1:16408)
    at t (/home/composer/node_modules/swagger-client/dist/index.js:1:177)
    at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:1:15877) code: 'MODULE_NOT_FOUND' }
[2018-05-28 06:38:41] PM2 log: App [composer-rest-server] with id [0] and pid [14], exited with code [1] via signal [SIGINT]

I installed base64-js via npm but still get the same error

回答1:

Following on from the previous answer and comments:

There has been a problem last week building the Docker Images for Composer, so the version with the "latest" tag is v0.19.5.

If you look at this page on Docker Hub you can see the problem:

https://hub.docker.com/r/hyperledger/composer-rest-server/tags/

As a temporary measure, if you run these 2 docker commands you should get a v0.19.6 version of the image that will be compatible with your v0.19.6 installed modules.

docker pull hyperledger/composer-rest-server:0.19.6-20180524041020

docker tag hyperledger/composer-rest-server:0.19.6-20180524041020 hyperledger/composer-rest-server:latest

I would suggest using docker rmi to remove any existing composer-rest-server images before using the commands above.

UPDATE After Later Comments - AND Appology

I'm sorry - I thought this would work and that these versions would be compatible.

To get compatibility now, you could re-install everything to v0.19.5 and use the 'trick' above to pull a composer-rest-server v0.19.5 and rename to latest (having removed the earlier one first)

or

you could uninstall composer and install the date specific version to be compatible with the container version. (you will need to restart fabric and re-deploy the network again.) e.g. npm install -g composer-cli@0.19.6-20180524041020

I have not tested this!



回答2:

see https://github.com/hyperledger/composer/issues/4067 A bad swagger-client npm module was published 3 days ago which caused the problem. A new version of swagger-client 3.8.6 has now been published to fix the problem.