Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having problems getting this to work on wsl #181

Open
ImAliMoussa opened this issue May 29, 2020 · 0 comments
Open

Having problems getting this to work on wsl #181

ImAliMoussa opened this issue May 29, 2020 · 0 comments

Comments

@ImAliMoussa
Copy link

ImAliMoussa commented May 29, 2020

I am on a windows machine running microsoft's bash terminal, also called wsl (windows subsystem for linux) and I am unable to run material kit properly.

So I did npm run open-app and got this error:

`> [email protected] open-app /mnt/c/Users/ali/Desktop/webdev/tmp/material-kit-master

gulp open-app
[19:19:41] Using gulpfile /mnt/c/Users/ali/Desktop/webdev/tmp/material-kit-master/gulpfile.js
[19:19:41] Starting 'open-app'...
[19:19:41] Starting 'open'...
[19:19:41] Starting 'watch'...
[19:19:42] Opening /mnt/c/Users/ali/Desktop/webdev/tmp/material-kit-master/index.html using the default OS app
(node:2007) UnhandledPromiseRejectionWarning: Error: Exited with code 1
at ChildProcess. (/mnt/c/Users/ali/Desktop/webdev/tmp/material-kit-master/node_modules/opn/index.js:84:13)
at Object.onceWrapper (events.js:422:26)
at ChildProcess.emit (events.js:315:20)
at ChildProcess.EventEmitter.emit (domain.js:547:15)
at maybeClose (internal/child_process.js:1051:16)
at Socket. (internal/child_process.js:442:11)
at Socket.emit (events.js:315:20)
at Socket.EventEmitter.emit (domain.js:547:15)
at Pipe. (net.js:670:12)
(Use node --trace-warnings ... to show where the warning was created)
(node:2007) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2007) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.`

So I open the file the material-kit-master/node_modules/opn/index.js file and scrolled to line 84 and after reading the file and a lot of console.log()'s of variables I ended up with this very very hacky solution. Basically I spawn a child process with argument 'cmd.exe' and argument absolute path to material kit index.html. Basically I removed all elements in the args array but the last one.

So I added this line:
args = [args[args.length - 1]];

before this one:
const cp = childProcess.spawn(cmd, args, cpOpts);
in the material-kit-master/node_modules/opn/index.js file/

It worked. But it doesn't watch the index.html file. So like if I added code it doesn't automatically refresh in the browser, which isn't ideal. I would appreciate any help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant