API не работает на Ubuntu 16.04 (Unexpected token ,)



  • API не работает на Ubuntu 16.04, если запустить API, то получается такое

    sudo npm start server.js
    
    > smartholdem-rpc@1.0.1 start /home/supervisor/smartholdem-api-1/smartholdem-rpc
    > nodemon ./server.js "server.js"
    
    [nodemon] 1.14.11
    [nodemon] to restart at any time, enter `rs`
    [nodemon] watching: *.*
    [nodemon] starting `node ./server.js server.js`
    /home/supervisor/smartholdem-api-1/smartholdem-rpc/src/account.js:131
    get,
       ^
    
    SyntaxError: Unexpected token ,
        at exports.runInThisContext (vm.js:53:16)
        at Module._compile (module.js:374:25)
        at Object.Module._extensions..js (module.js:417:10)
        at Module.load (module.js:344:32)
        at Function.Module._load (module.js:301:12)
        at Module.require (module.js:354:17)
        at require (internal/module.js:12:17)
        at Object.<anonymous> (/home/supervisor/smartholdem-api-1/smartholdem-rpc/server.js:4:15)
        at Module._compile (module.js:410:26)
        at Object.Module._extensions..js (module.js:417:10)
    [nodemon] app crashed - waiting for file changes before starting...
    

    Пробовал на 2 разных серверах, результат тот-же:

    /home/supervisor/smartholdem-api-1/smartholdem-rpc/src/account.js:131
    get,
       ^
    
    SyntaxError: Unexpected token ,
    
    
    supervisor@659350:~/smartholdem-api-1/smartholdem-rpc$ node -v
    v8.9.4
    supervisor@659350:~/smartholdem-api-1/smartholdem-rpc$ npm -v
    5.6.0


  • На всякий случай весь лог инсталяции

    supervisor@659350:~/smartholdem-api-1/smartholdem-rpc$ sudo npm install
    npm WARN optional dep failed, continuing fsevents@1.1.3
    
    > dtrace-provider@0.8.5 install /home/supervisor/smartholdem-api-1/smartholdem-rpc/node_modules/restify/node_modules/d                                         trace-provider
    > node scripts/install.js
    
    
    > nodemon@1.14.11 postinstall /home/supervisor/smartholdem-api-1/smartholdem-rpc/node_modules/nodemon
    > node -e "console.log('\u001b[32mLove nodemon? You can now support the project via the open collective:\u001b[22m\u00                                         1b[39m\n > \u001b[96m\u001b[1mhttps://opencollective.com/nodemon/donate\u001b[0m\n')" || exit 0
    
    Love nodemon? You can now support the project via the open collective:
     > https://opencollective.com/nodemon/donate
    
    
    > leveldown@2.1.1 install /home/supervisor/smartholdem-api-1/smartholdem-rpc/node_modules/leveldown
    > prebuild-install || node-gyp rebuild
    
    prebuild-install info begin Prebuild-install version 2.4.1
    prebuild-install info looking for local prebuild @ prebuilds/leveldown-v2.1.1-node-v46-linux-x64.tar.gz
    prebuild-install info looking for cached prebuild @ /home/supervisor/.npm/_prebuilds/https-github.com-level-leveldown-                                         releases-download-v2.1.1-leveldown-v2.1.1-node-v46-linux-x64.tar.gz
    prebuild-install info found cached prebuild
    prebuild-install info unpacking @ /home/supervisor/.npm/_prebuilds/https-github.com-level-leveldown-releases-download-                                         v2.1.1-leveldown-v2.1.1-node-v46-linux-x64.tar.gz
    prebuild-install info unpack resolved to /home/supervisor/smartholdem-api-1/smartholdem-rpc/node_modules/leveldown/bui                                         ld/Release/leveldown.node
    prebuild-install info unpack required /home/supervisor/smartholdem-api-1/smartholdem-rpc/node_modules/leveldown/build/                                         Release/leveldown.node successfully
    prebuild-install info install Successfully installed prebuilt binary!
    -
    > secp256k1@3.4.0 install /home/supervisor/smartholdem-api-1/smartholdem-rpc/node_modules/sthjs/node_modules/secp256k1
    > npm run rebuild || echo "Secp256k1 bindings compilation fail. Pure JS implementation will be used."
    
    
    > secp256k1@3.4.0 rebuild /home/supervisor/smartholdem-api-1/smartholdem-rpc/node_modules/sthjs/node_modules/secp256k1
    > node-gyp rebuild
    
    make: Entering directory '/home/supervisor/smartholdem-api-1/smartholdem-rpc/node_modules/sthjs/node_modules/secp256k1                                         /build'
      CXX(target) Release/obj.target/secp256k1/src/addon.o
      CXX(target) Release/obj.target/secp256k1/src/privatekey.o
      CXX(target) Release/obj.target/secp256k1/src/publickey.o
      CXX(target) Release/obj.target/secp256k1/src/signature.o
      CXX(target) Release/obj.target/secp256k1/src/ecdsa.o
      CXX(target) Release/obj.target/secp256k1/src/ecdh.o
      CC(target) Release/obj.target/secp256k1/src/secp256k1-src/src/secp256k1.o
      CC(target) Release/obj.target/secp256k1/src/secp256k1-src/contrib/lax_der_parsing.o
      CC(target) Release/obj.target/secp256k1/src/secp256k1-src/contrib/lax_der_privatekey_parsing.o
      SOLINK_MODULE(target) Release/obj.target/secp256k1.node
      COPY Release/secp256k1.node
    make: Leaving directory '/home/supervisor/smartholdem-api-1/smartholdem-rpc/node_modules/sthjs/node_modules/secp256k1/build'
    commander@2.13.0 node_modules/commander
    
    bigi@1.4.2 node_modules/bigi
    
    chai@3.5.0 node_modules/chai
    ├── assertion-error@1.1.0
    ├── type-detect@1.0.0
    └── deep-eql@0.1.3 (type-detect@0.1.1)
    
    bip38@2.0.2 node_modules/bip38
    ├── scryptsy@2.0.0
    ├── buffer-xor@1.0.3
    ├── ecurve@1.0.6 (safe-buffer@5.1.1)
    ├── bs58check@2.1.1 (bs58@4.0.1)
    ├── create-hash@1.1.3 (inherits@2.0.3, ripemd160@2.0.1, cipher-base@1.0.4, sha.js@2.4.9)
    └── browserify-aes@1.1.1 (inherits@2.0.3, safe-buffer@5.1.1, cipher-base@1.0.4, evp_bytestokey@1.0.3)
    
    bip39@2.5.0 node_modules/bip39
    ├── unorm@1.4.1
    ├── safe-buffer@5.1.1
    ├── randombytes@2.0.6
    ├── create-hash@1.1.3 (inherits@2.0.3, cipher-base@1.0.4, sha.js@2.4.9, ripemd160@2.0.1)
    └── pbkdf2@3.0.14 (ripemd160@2.0.1, create-hmac@1.1.6, sha.js@2.4.9)
    
    chai-http@2.0.1 node_modules/chai-http
    ├── methods@0.0.1
    ├── cookiejar@2.0.6
    ├── qs@2.0.0
    ├── is-ip@1.0.0 (ip-regex@1.0.3)
    └── superagent@1.2.0 (extend@1.2.1, cookiejar@2.0.1, methods@1.0.1, component-emitter@1.1.2, reduce-component@1.0.1, mime@1.3.4, qs@2.3.3, readable-stream@1.0.27-1, debug@2.6.9, form-data@0.2.0, formidable@1.0.14)
    
    levelup@2.0.1 node_modules/levelup
    ├── xtend@4.0.1
    ├── level-errors@1.1.2 (errno@0.1.6)
    ├── deferred-leveldown@2.0.3 (abstract-leveldown@3.0.0)
    └── level-iterator-stream@2.0.0 (inherits@2.0.3, readable-stream@2.3.3)
    
    mocha@4.1.0 node_modules/mocha
    ├── browser-stdout@1.3.0
    ├── escape-string-regexp@1.0.5
    ├── commander@2.11.0
    ├── he@1.1.1
    ├── growl@1.10.3
    ├── supports-color@4.4.0 (has-flag@2.0.0)
    ├── debug@3.1.0 (ms@2.0.0)
    ├── diff@3.3.1
    ├── mkdirp@0.5.1 (minimist@0.0.8)
    └── glob@7.1.2 (path-is-absolute@1.0.1, inherits@2.0.3, fs.realpath@1.0.0, once@1.4.0, inflight@1.0.6, minimatch@3.0.4)
    
    request@2.83.0 node_modules/request
    ├── aws-sign2@0.7.0
    ├── forever-agent@0.6.1
    ├── oauth-sign@0.8.2
    ├── tunnel-agent@0.6.0
    ├── is-typedarray@1.0.0
    ├── caseless@0.12.0
    ├── safe-buffer@5.1.1
    ├── stringstream@0.0.5
    ├── aws4@1.6.0
    ├── isstream@0.1.2
    ├── json-stringify-safe@5.0.1
    ├── extend@3.0.1
    ├── performance-now@2.1.0
    ├── uuid@3.1.0
    ├── qs@6.5.1
    ├── combined-stream@1.0.5 (delayed-stream@1.0.0)
    ├── mime-types@2.1.17 (mime-db@1.30.0)
    ├── tough-cookie@2.3.3 (punycode@1.4.1)
    ├── form-data@2.3.1 (asynckit@0.4.0)
    ├── hawk@6.0.2 (boom@4.3.1, sntp@2.1.0, hoek@4.2.0, cryptiles@3.1.2)
    ├── http-signature@1.2.0 (assert-plus@1.0.0, jsprim@1.4.1, sshpk@1.13.1)
    └── har-validator@5.0.3 (har-schema@2.0.0, ajv@5.5.2)
    
    nodemon@1.14.11 node_modules/nodemon
    ├── ignore-by-default@1.0.1
    ├── semver@5.4.1
    ├── debug@3.1.0 (ms@2.0.0)
    ├── minimatch@3.0.4 (brace-expansion@1.1.8)
    ├── touch@3.1.0 (nopt@1.0.10)
    ├── undefsafe@2.0.1 (debug@2.6.9)
    ├── pstree.remy@1.1.0 (ps-tree@1.1.0)
    ├── update-notifier@2.3.0 (is-npm@1.0.0, semver-diff@2.1.0, xdg-basedir@3.0.0, import-lazy@2.1.0, is-installed-globally@0.1.0, configstore@3.1.1, chalk@2.3.0, latest-version@3.1.0, boxen@1.3.0)
    └── chokidar@2.0.0 (path-is-absolute@1.0.1, async-each@1.0.1, inherits@2.0.3, is-binary-path@1.0.1, is-glob@4.0.0, normalize-path@2.1.1, glob-parent@3.1.0, readdirp@2.1.0, braces@2.3.0, anymatch@2.0.0)
    
    leveldown@2.1.1 node_modules/leveldown
    ├── bindings@1.3.0
    ├── fast-future@1.0.2
    ├── abstract-leveldown@3.0.0 (xtend@4.0.1)
    ├── nan@2.8.0
    └── prebuild-install@2.4.1 (os-homedir@1.0.2, expand-template@1.1.0, noop-logger@0.1.1, xtend@4.0.1, github-from-package@0.0.0, minimist@1.2.0, tunnel-agent@0.6.0, node-abi@2.1.2, rc@1.2.3, simple-get@1.4.3, pump@1.0.3, mkdirp@0.5.1, npmlog@4.1.2, tar-fs@1.16.0)
    
    restify@6.3.4 node_modules/restify
    ├── ewma@2.0.1
    ├── assert-plus@1.0.0
    ├── escape-regexp-component@1.0.2
    ├── semver@5.4.1
    ├── negotiator@0.6.1
    ├── mime@1.6.0
    ├── formidable@1.1.1
    ├── pidusage@1.2.0
    ├── uuid@3.1.0
    ├── clone-regexp@1.0.0 (is-regexp@1.0.0, is-supported-regexp-flag@1.0.0)
    ├── once@1.4.0 (wrappy@1.0.2)
    ├── qs@6.5.1
    ├── lru-cache@4.1.1 (yallist@2.1.2, pseudomap@1.0.2)
    ├── restify-errors@5.0.0 (safe-json-stringify@1.0.4)
    ├── verror@1.10.0 (core-util-is@1.0.2, extsprintf@1.4.0)
    ├── csv@1.2.1 (csv-generate@1.1.2, stream-transform@0.2.2, csv-parse@1.3.3, csv-stringify@1.1.2)
    ├── vasync@1.6.4 (verror@1.6.0)
    ├── http-signature@1.2.0 (jsprim@1.4.1, sshpk@1.13.1)
    ├── dtrace-provider@0.8.5 (nan@2.8.0)
    ├── spdy@3.4.7 (http-deceiver@1.2.7, safe-buffer@5.1.1, handle-thing@1.2.5, select-hose@2.0.0, debug@2.6.9, spdy-transport@2.0.20)
    ├── bunyan@1.8.12 (safe-json-stringify@1.0.4, mv@2.1.1, moment@2.20.1)
    └── lodash@4.17.4
    
    async@2.6.0 node_modules/async
    └── lodash@4.17.4
    
    sthjs@0.2.1 node_modules/sthjs
    ├── browserify-bignum@1.3.0-2
    ├── typeforce@1.12.0
    ├── wif@2.0.6
    ├── ecdsa@0.7.0
    ├── bip66@1.1.5 (safe-buffer@5.1.1)
    ├── randombytes@2.0.6 (safe-buffer@5.1.1)
    ├── ecurve@1.0.6 (safe-buffer@5.1.1)
    ├── create-hmac@1.1.6 (inherits@2.0.3, safe-buffer@5.1.1, cipher-base@1.0.4, create-hash@1.1.3, sha.js@2.4.9, ripemd160@2.0.1)
    ├── js-nacl@1.2.1
    ├── buffer@4.9.1 (ieee754@1.1.8, isarray@1.0.0, base64-js@1.2.1)
    ├── bs58check@1.3.4 (bs58@3.1.0, create-hash@1.1.3)
    ├── mocha@3.1.0 (diff@1.4.0, escape-string-regexp@1.0.5, browser-stdout@1.3.0, growl@1.9.2, json3@3.3.2, supports-color@3.1.2, commander@2.9.0, debug@2.2.0, mkdirp@0.5.1, lodash.create@3.1.1, glob@7.0.5)
    ├── bytebuffer@5.0.1 (long@3.2.0)
    ├── crypto-browserify@3.11.0 (inherits@2.0.3, pbkdf2@3.0.14, diffie-hellman@5.0.2, create-hash@1.1.3, browserify-cipher@1.0.0, create-ecdh@4.0.0, browserify-sign@4.0.4, public-encrypt@4.0.0)
    └── secp256k1@3.4.0 (bindings@1.3.0, safe-buffer@5.1.1, bn.js@4.11.8, create-hash@1.1.3, nan@2.8.0, elliptic@6.4.0, drbg.js@1.0.1)

  • administrators

    могу предложить

    nvm use 6.9.5

    если кто не в курсе надо заново после подобных действий

    npm install

    далее к примеру в убунте синтаксис другой без слэшей и присутствуют одинарные кавычки

    curl -H "Content-Type: application/json" -X POST "http://127.0.0.1:8081/mainnet/account" -d '{"passphrase":"TestPassWord"}'


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.