nice-table / bitmex-scaled-orders

A front-end for creating scaled orders / bulk orders on Bitmex
MIT License
118 stars 38 forks source link

Failed at the bmex-orderer@0.6.2 startup script. #13

Open Poilaucul opened 5 years ago

Poilaucul commented 5 years ago

Hello, I can't startup the instance on Ubuntu 18.04.1 LTS, npm 6.4.1 & node v11.3.0


> bmex-orderer@0.6.2 startup /home/desktop/bitmex-scaled-orders
> concurrently --allow-restart "npm:proxy" "npm:start"

[proxy]
[proxy] > bmex-orderer@0.6.2 proxy /home/desktop/bitmex-scaled-orders
[proxy] > node backend/proxy.js
[proxy]
[start]
[start] > bmex-orderer@0.6.2 start /home/desktop/bitmex-scaled-orders
[start] > react-scripts start
[start]
[proxy] internal/modules/cjs/loader.js:605
[proxy]     throw err;
[proxy]     ^
[proxy]
[proxy] Error: Cannot find module '../src/config'
[proxy]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
[proxy]     at Function.Module._load (internal/modules/cjs/loader.js:529:25)
[proxy]     at Module.require (internal/modules/cjs/loader.js:658:17)
[proxy]     at require (internal/modules/cjs/helpers.js:22:18)
[proxy]     at Object.<anonymous> (/home/desktop/bitmex-scaled-orders/backend/restProxy.js:10:16)
[proxy]     at Module._compile (internal/modules/cjs/loader.js:722:30)
[proxy]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
[proxy]     at Module.load (internal/modules/cjs/loader.js:620:32)
[proxy]     at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
[proxy]     at Function.Module._load (internal/modules/cjs/loader.js:552:3)
[proxy] npm ERR! code ELIFECYCLE
[proxy] npm ERR! errno 1
[proxy] npm ERR! bmex-orderer@0.6.2 proxy: `node backend/proxy.js`
[proxy] npm ERR! Exit status 1
[proxy] npm ERR!
[proxy] npm ERR! Failed at the bmex-orderer@0.6.2 proxy script.
[proxy] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[proxy]
[proxy] npm ERR! A complete log of this run can be found in:
[proxy] npm ERR!     /root/.npm/_logs/2018-12-03T22_42_18_638Z-debug.log
[proxy] npm run proxy exited with code 1
[proxy] npm run proxy restarted
[proxy]
[proxy] > bmex-orderer@0.6.2 proxy /home/desktop/bitmex-scaled-orders
[proxy] > node backend/proxy.js
[proxy]
[proxy] internal/modules/cjs/loader.js:605
[proxy]     throw err;
[proxy]     ^
[proxy]
[proxy] Error: Cannot find module '../src/config'
[proxy]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
[proxy]     at Function.Module._load (internal/modules/cjs/loader.js:529:25)
[proxy]     at Module.require (internal/modules/cjs/loader.js:658:17)
[proxy]     at require (internal/modules/cjs/helpers.js:22:18)
[proxy]     at Object.<anonymous> (/home/desktop/bitmex-scaled-orders/backend/restProxy.js:10:16)
[proxy]     at Module._compile (internal/modules/cjs/loader.js:722:30)
[proxy]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
[proxy]     at Module.load (internal/modules/cjs/loader.js:620:32)
[proxy]     at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
[proxy]     at Function.Module._load (internal/modules/cjs/loader.js:552:3)
[proxy] npm ERR! code ELIFECYCLE
npm ERR! errno 1
[proxy] npm ERR! bmex-orderer@0.6.2 proxy: `node backend/proxy.js`
[proxy] npm ERR! Exit status 1
[proxy] npm ERR!
[proxy] npm ERR! Failed at the bmex-orderer@0.6.2 proxy script.
[proxy] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[proxy]
[proxy] npm ERR! A complete log of this run can be found in:
[proxy] npm ERR!     /root/.npm/_logs/2018-12-03T22_42_19_421Z-debug.log
[proxy] npm run proxy exited with code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bmex-orderer@0.6.2 startup: `concurrently --allow-restart "npm:proxy" "npm:start"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bmex-orderer@0.6.2 startup 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/2018-12-03T22_42_19_445Z-debug.log
root@andromeda:/home/desktop/bitmex-scaled-orders# ll
total 700
drwxr-xr-x    7 root    root      4096 déc.   3 23:23 ./
drwxr-xr-x   52 desktop desktop   4096 déc.   3 23:14 ../
drwxr-xr-x    2 root    root      4096 déc.   3 23:14 backend/
-rw-r--r--    1 root    root        24 déc.   3 23:14 .env
-rw-r--r--    1 root    root        29 déc.   3 23:14 .eslintrc
drwxr-xr-x    8 root    root      4096 déc.   3 23:14 .git/
-rw-r--r--    1 root    root       285 déc.   3 23:14 .gitignore
-rw-r--r--    1 root    root      1067 déc.   3 23:14 LICENSE
drwxr-xr-x 1132 root    root     36864 déc.   3 23:36 node_modules/
-rw-r--r--    1 root    root      1817 déc.   3 23:26 package.json
-rw-r--r--    1 root    root    615615 déc.   3 23:23 package-lock.json
-rw-r--r--    1 root    root       314 déc.   3 23:14 postinstall.js
-rw-r--r--    1 root    root         7 déc.   3 23:14 .prettierignore
drwxr-xr-x    2 root    root      4096 déc.   3 23:14 public/
-rw-r--r--    1 root    root      1819 déc.   3 23:14 README.md
drwxr-xr-x    7 root    root      4096 déc.   3 23:14 src/
root@andromeda:/home/desktop/bitmex-scaled-orders#
root@andromeda:/home/desktop/bitmex-scaled-orders# uname -a
Linux andromeda 4.15.0-34-generic #37-Ubuntu SMP Mon Aug 27 15:21:48 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
root@andromeda:/home/desktop/bitmex-scaled-orders#
root@andromeda:/home/desktop/bitmex-scaled-orders#
root@andromeda:/home/desktop/bitmex-scaled-orders# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic
root@andromeda:/home/desktop/bitmex-scaled-orders#
ahmedengu commented 5 years ago

Greetings,

you may update:

const config = require("../src/config");

to:

const config = require("../src/config/index.example.js");

in the following files:

backend/restProxy.js
backend/websocket.js

And

import { httpProxyPort } from "config";

to:

import { httpProxyPort } from "config/index.example.js";

in the following files:

src/modules/api/BitmexFetch.js
src/modules/data/DataProvider.js

Best Regards, Ahmed

Poilaucul commented 5 years ago

Hi,

Thanks, this is what I get now:

root@andromeda:/home/desktop/bitmex-scaled-orders# npm install

> uglifyjs-webpack-plugin@0.4.6 postinstall /home/desktop/bitmex-scaled-orders/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js

> nodemon@1.17.5 postinstall /home/desktop/bitmex-scaled-orders/node_modules/nodemon
> node bin/postinstall || exit 0

Love nodemon? You can now support the project via the open collective:
 > https://opencollective.com/nodemon/donate

> styled-components@3.4.2 postinstall /home/desktop/bitmex-scaled-orders/node_modules/styled-components
> node ./scripts/postinstall.js || exit 0

Use styled-components at work? Consider supporting our development efforts at opencollective.com/styled-components
npm WARN lifecycle bmex-orderer@0.6.2~postinstall: cannot run in wd bmex-orderer@0.6.2 node postinstall.js (wd=/home/desktop/bitmex-scaled-orders)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 1417 packages from 848 contributors and audited 16090 packages in 31.939s
found 5 vulnerabilities (2 low, 3 high)
  run `npm audit fix` to fix them, or `npm audit` for details

   ╭───────────────────────────────────────────────────────────────╮
   │                                                               │
   │       New minor version of npm available! 6.5.0 → 6.7.0       │
   │   Changelog: https://github.com/npm/cli/releases/tag/v6.7.0   │
   │               Run npm install -g npm to update!               │
   │                                                               │
   ╰───────────────────────────────────────────────────────────────╯

root@andromeda:/home/desktop/bitmex-scaled-orders# npm run startup

> bmex-orderer@0.6.2 startup /home/desktop/bitmex-scaled-orders
> concurrently --allow-restart "npm:proxy" "npm:start"

[proxy]
[proxy] > bmex-orderer@0.6.2 proxy /home/desktop/bitmex-scaled-orders
[proxy] > node backend/proxy.js
[proxy]
[start]
[start] > bmex-orderer@0.6.2 start /home/desktop/bitmex-scaled-orders
[start] > react-scripts start
[start]
[proxy] Started webocket server on port 1337
[proxy] Started BitMEX proxy on port 8000
[start] Starting the development server...
[start]
[start] Failed to compile.
[start]
[start] ./src/App.js
[start] Module not found: Can't resolve 'containers/Dashboard' in '/home/desktop/bitmex-scaled-orders/src'
[start] Compiling...
[start] Failed to compile.
[start]
[start] ./src/App.js
[start] Module not found: Can't resolve 'containers/Dashboard' in '/home/desktop/bitmex-scaled-orders/src'

[proxy] internal/crypto/keys.js:279
[proxy]       throw new ERR_INVALID_ARG_TYPE(
[proxy]       ^
[proxy]
[proxy] TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be one of type Buffer, TypedArray, DataView, string, or KeyObject. Received type undefined
[proxy]     at prepareSecretKey (internal/crypto/keys.js:279:13)
[proxy]     at new Hmac (internal/crypto/hash.js:95:9)
[proxy]     at Object.createHmac (crypto.js:137:10)
[proxy]     at createBitmexSignature (/home/desktop/bitmex-scaled-orders/backend/restProxy.js:25:6)
[proxy]     at ProxyServer.<anonymous> (/home/desktop/bitmex-scaled-orders/backend/restProxy.js:45:36)
[proxy]     at ProxyServer.emit (/home/desktop/bitmex-scaled-orders/node_modules/eventemitter3/index.js:119:35)
[proxy]     at ClientRequest.<anonymous> (/home/desktop/bitmex-scaled-orders/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:125:27)
[proxy]     at ClientRequest.emit (events.js:202:15)
[proxy]     at tickOnSocket (_http_client.js:661:7)
[proxy]     at onSocketNT (_http_client.js:700:5)
[proxy] npm ERR! code ELIFECYCLE
[proxy] npm ERR! errno 1
[proxy] npm ERR! bmex-orderer@0.6.2 proxy: `node backend/proxy.js`
[proxy] npm ERR! Exit status 1
[proxy] npm ERR!
[proxy] npm ERR! Failed at the bmex-orderer@0.6.2 proxy script.
[proxy] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[proxy]
[proxy] npm ERR! A complete log of this run can be found in:
[proxy] npm ERR!     /root/.npm/_logs/2019-02-07T23_05_05_934Z-debug.log
[proxy] npm run proxy exited with code 1
[proxy] npm run proxy restarted
[proxy]
[proxy] > bmex-orderer@0.6.2 proxy /home/desktop/bitmex-scaled-orders
[proxy] > node backend/proxy.js
[proxy]
[proxy] Started webocket server on port 1337
[proxy] Started BitMEX proxy on port 8000
[proxy] internal/crypto/keys.js:279
[proxy]       throw new ERR_INVALID_ARG_TYPE(
[proxy]       ^
[proxy]
[proxy] TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be one of type Buffer, TypedArray, DataView, string, or KeyObject. Received type undefined
[proxy]     at prepareSecretKey (internal/crypto/keys.js:279:13)
[proxy]     at new Hmac (internal/crypto/hash.js:95:9)
[proxy]     at Object.createHmac (crypto.js:137:10)
[proxy]     at createBitmexSignature (/home/desktop/bitmex-scaled-orders/backend/restProxy.js:25:6)
[proxy]     at ProxyServer.<anonymous> (/home/desktop/bitmex-scaled-orders/backend/restProxy.js:45:36)
[proxy]     at ProxyServer.emit (/home/desktop/bitmex-scaled-orders/node_modules/eventemitter3/index.js:119:35)
[proxy]     at ClientRequest.<anonymous> (/home/desktop/bitmex-scaled-orders/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:125:27)
[proxy]     at ClientRequest.emit (events.js:202:15)
[proxy]     at tickOnSocket (_http_client.js:661:7)
[proxy]     at onSocketNT (_http_client.js:700:5)
[proxy] npm ERR! code ELIFECYCLE
[proxy] npm ERR! errno 1
[proxy] npm ERR! bmex-orderer@0.6.2 proxy: `node backend/proxy.js`
[proxy] npm ERR! Exit status 1
[proxy] npm ERR!
[proxy] npm ERR! Failed at the bmex-orderer@0.6.2 proxy script.
[proxy] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[proxy]
[proxy] npm ERR! A complete log of this run can be found in:
[proxy] npm ERR!     /root/.npm/_logs/2019-02-07T23_05_36_007Z-debug.log
[proxy] npm run proxy exited with code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bmex-orderer@0.6.2 startup: `concurrently --allow-restart "npm:proxy" "npm:start"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bmex-orderer@0.6.2 startup 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/2019-02-07T23_05_36_034Z-debug.log
root@andromeda:/home/desktop/bitmex-scaled-orders#
ahmedengu commented 5 years ago

Well the issue is node not discovering the modules per folder so you need to update the code to point to js files instead of folders so for example update src/App.js with:

import Dashboard from "containers/Dashboard";

to:

import Dashboard from "containers/Dashboard/index.js";

so you basically need to modify the path to point to the file not the folder, not sure what causes this problem the project worked right away on my windows 10 with node v10.14.2 however it didn't work on my ubutnu server with node v8.11.2 and i was able to fix it with my previous answer. this may help https://stackoverflow.com/questions/42163049/node-js-require-from-parent-folder

Poilaucul commented 5 years ago

Thanks @ahmedengu Indeed it works out of the box on windows but not on Linux, shame, I would be great to have this running OOTB on a dedicated local Linux server.