converge/instapy-dashboard

Not starting at remote Ubuntu

Laurent105 opened this issue · 4 comments

Hi there!

Really want to start Dashboard on InstaPy. Following instructions, I receive the following error. FYI, working on Lightsail AWS.

ubuntu@ip-xx-xx-xx-xx:~/instapy-dashboard$ sudo npm start
instapy-dashboard@0.3.0 start /home/ubuntu/instapy-dashboard
concurrently --kill-others-on-fail "react-scripts start" "npm run server"
[1]
[1] > instapy-dashboard@0.3.0 server /home/ubuntu/instapy-dashboard
[1] > node ./src/services/server.js
[1]
[1] /home/ubuntu/instapy-dashboard/src/services/server.js:10
[1] const allowedHosts = process.env.ALLOWED_HOSTS.split(' ')
[1] ^
[1]
[1] TypeError: Cannot read property 'split' of undefined
[1] at Object. (/home/ubuntu/instapy-dashboard/src/services/server.js:10:48)
[1] at Module._compile (internal/modules/cjs/loader.js:805:30)
[1] at Object.Module._extensions..js (internal/modules/cjs/loader.js:816:10)
[1] at Module.load (internal/modules/cjs/loader.js:672:32)
[1] at tryModuleLoad (internal/modules/cjs/loader.js:612:12)
[1] at Function.Module._load (internal/modules/cjs/loader.js:604:3)
[1] at Function.Module.runMain (internal/modules/cjs/loader.js:868:12)
[1] at internal/main/run_main_module.js:21:11
[1] npm ERR! code ELIFECYCLE
[1] npm ERR! errno 1
[1] npm ERR! instapy-dashboard@0.3.0 server: node ./src/services/server.js
[1] npm ERR! Exit status 1
[1] npm ERR!
[1] npm ERR! Failed at the instapy-dashboard@0.3.0 server script.
[1] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[1]
[1] npm ERR! A complete log of this run can be found in:
[1] npm ERR! /home/ubuntu/.npm/_logs/2019-04-08T16_02_34_324Z-debug.log
[1] npm run server exited with code 1
--> Sending SIGTERM to other processes..
[0] react-scripts start exited with code SIGTERM
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! instapy-dashboard@0.3.0 start: concurrently --kill-others-on-fail "react-scripts start" "npm run server"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the instapy-dashboard@0.3.0 start 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! /home/ubuntu/.npm/_logs/2019-04-08T16_02_34_388Z-debug.log

And the log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.7.0
3 info using node@v11.13.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle instapy-dashboard@0.3.0prestart: instapy-dashboard@0.3.0
6 info lifecycle instapy-dashboard@0.3.0
start: instapy-dashboard@0.3.0
7 verbose lifecycle instapy-dashboard@0.3.0start: unsafe-perm in lifecycle true
8 verbose lifecycle instapy-dashboard@0.3.0
start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/ubuntu/instapy-dashboard/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
9 verbose lifecycle instapy-dashboard@0.3.0start: CWD: /home/ubuntu/instapy-dashboard
10 silly lifecycle instapy-dashboard@0.3.0
start: Args: [ '-c',
10 silly lifecycle 'concurrently --kill-others-on-fail "react-scripts start" "npm run server"' ]
11 silly lifecycle instapy-dashboard@0.3.0start: Returned: code: 1 signal: null
12 info lifecycle instapy-dashboard@0.3.0
start: Failed to exec start script
13 verbose stack Error: instapy-dashboard@0.3.0 start: concurrently --kill-others-on-fail "react-scripts start" "npm run server"
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:193:13)
13 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:193:13)
13 verbose stack at maybeClose (internal/child_process.js:1001:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
14 verbose pkgid instapy-dashboard@0.3.0
15 verbose cwd /home/ubuntu/instapy-dashboard
16 verbose Linux 4.15.0-1035-aws
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v11.13.0
19 verbose npm v6.7.0
20 error code ELIFECYCLE
21 error errno 1
22 error instapy-dashboard@0.3.0 start: concurrently --kill-others-on-fail "react-scripts start" "npm run server"
22 error Exit status 1
23 error Failed at the instapy-dashboard@0.3.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Thanks in advance for help!

did you create the .env file ?

Of course:

ls -l

-rw-r--r--    1 root root   2432 Apr  8 15:33 README.md
drwxr-xr-x    3 root root   4096 Apr  8 14:27 __tests__
drwxr-xr-x 1199 root root  36864 Apr  8 15:54 node_modules
-rw-r--r--    1 root root   2829 Apr  8 15:33 npm-debug.log
-rw-r--r--    1 root root 789884 Apr  8 15:53 package-lock.json
-rw-r--r--    1 root root   1363 Apr  8 14:53 package.json
drwxr-xr-x    2 root root   4096 Apr  8 14:27 public
drwxr-xr-x    2 root root   4096 Apr  8 14:27 screenshots
-rw-r--r--    1 root root    464 Apr  8 15:31 setup.env
drwxr-xr-x    4 root root   4096 Apr  8 14:27 src

Content of setup.env

# MacOS: /Users/your_user_name/InstaPy
# you can also check this information when running your quickstart.py, 
'# the first lines contains
# -> Workspace in use: "/Users/converge/InstaPy"
INSTAPY_FOLDER=/home/ubuntu/InstaPy
# if using only on localhost, keep it:
ALLOWED_HOSTS=http://localhost:3000 http://localhost:3000
REACT_APP_API_ENTRY_POINT=http://localhost:3001
# basic setup, ok to keep it ->
# Node port
NODE_PORT=3001
# ReactJS Create APP port
PORT=3000

I've tried replacing localhost with public IP. And JFI 3000 and 3001 ports are opened in firewall.

the file name should be .env , your file name is actually setup.env

Thanks for help, that fixed. Maybe a good idea to give that file a name or put ".env" in brackets in the readme? It's not intuitive.

Now I will try to fix problem in InstaPy blocking AWS server from responding any requests. While it is working, I cannot load the InstaPy-dashboard or SSH connect to the server itself.

Thanks for your work!