This repository was archived by the owner on Jan 4, 2024. It is now read-only.
This repository was archived by the owner on Jan 4, 2024. It is now read-only.
Doesn't work on Windows #6
Open
Description
Just following the quick start and immediately run into this error:
>>> settings.configure(USE_MANAGER=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python34\lib\site-packages\js_host\conf.py", line 55, in configure
from .host import host
File "C:\Python34\lib\site-packages\js_host\host.py", line 8, in <module>
manager = JSHostManager()
File "C:\Python34\lib\site-packages\js_host\base_server.py", line 70, in __init__
self.validate_status()
File "C:\Python34\lib\site-packages\js_host\base_server.py", line 214, in validate_status
version = self.get_version().split('.')
File "C:\Python34\lib\site-packages\js_host\base_server.py", line 117, in get_version
return self.get_status()['version']
File "C:\Python34\lib\site-packages\js_host\base_server.py", line 113, in get_status
self.status = self.read_config_file(self.get_path_to_config_file())
File "C:\Python34\lib\site-packages\js_host\base_server.py", line 104, in read_config_file
raise ConfigError(stderr)
js_host.exceptions.ConfigError: b'C:\\dev\\project\\static\\node_modules\\.bin\\js-host:2\r\nbasedir=`dirname "$0"`\r\n ^\r\nSyntaxError: Unexpected token ILLEGAL\r\n at exports.runInThisContext (vm.js:73:16)\r\n at Module._compile (module.js:443:25)\r\n at Object.Module._extensions..js (module.js:478:10)\r\n at Module.load (module.js:355:32)\r\n at Function.Module._load (module.js:310:12)\r\n at Function.Module.runMain (module.js:501:10)\r\n at startup (node.js:129:16)\r\n at node.js:814:3\r\n'
Edit:
Seems to be unrelated to the above error... js-host should run the .cmd file on Windows, not the bin/sh file. If I just run ./js-host.cmd from the command line:
$ ./node_modules/.bin/js-host.cmd ./host.config.js --manager
Manager listening at 127.0.0.1:9009
Here's how I fixed the python code to make this work:
base_server.py
96: (self.get_path_to_bin(), config_file, '--config',) + self.read_config_file_params,
108: (deleted - stdout.read() is already a string)
conf.py
24: BIN_PATH = os.path.join('node_modules', '.bin', 'js-host.cmd')
Then when I run django python manage.py runserver
my js-host server spins up in the console as expected:
$ ./node_modules/.bin/js-host.cmd ./host.config.js --manager
Manager listening at 127.0.0.1:9009
2015-05-09T18:57:16.281Z - info: GET /status
2015-05-09T18:57:16.332Z - info: GET /status
2015-05-09T18:57:16.368Z - info: GET /status
2015-05-09T18:57:16.404Z - info: POST /host/status
2015-05-09T18:57:17.328Z - info: GET /status
2015-05-09T18:57:17.366Z - info: POST /host/status
2015-05-09T18:57:17.401Z - info: POST /host/start
2015-05-09T18:57:17.403Z - info: Starting child host with config: C:\dev\project\static\host.config.js
2015-05-09T18:57:18.293Z - info: POST /host/connect
2015-05-09T18:57:18.296Z - info: Connection 1431197838295-66abca40-ebe7-46d3-ae91-d37587626412 opened to host with config C:\dev\project\static\host.config.js
2015-05-09T18:57:23.765Z - info: GET /status
2015-05-09T18:57:23.805Z - info: GET /status
2015-05-09T18:57:23.842Z - info: GET /status
2015-05-09T18:57:23.877Z - info: POST /host/status
2015-05-09T18:57:23.955Z - info: POST /host/connect
2015-05-09T18:57:23.956Z - info: Connection 1431197843956-4a681948-308f-4fd3-bfe2-fb197e8d1f67 opened to host with config C:\dev\project\static\host.config.js
But I'm no expert so I've no idea how to make this compatible with Windows without breaking the existing stuff as I've clearly done here. Anyway, I'm using this for now until a fix comes out. Cheers!
Metadata
Metadata
Assignees
Labels
No labels