Vue-devtools: Electron Unexpected token ... at createScript

Created on 22 Sep 2019  Â·  12Comments  Â·  Source: vuejs/vue-devtools

Version

5.1.1

Browser and OS info

Mac

Steps to reproduce

sudo npm install -g @vue/devtools

vue-devtools

What is expected?

it to load the electron app

What is actually happening?

electron app starts up
its alerts a js exception


Uncaught Exception:
/usr/local/lib/node_modules/@vue/devtools/node_modules/ws/lib/websocket.js:347
      ...options
      ^^^
SyntaxError: Unexpected token ...
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/@vue/devtools/node_modules/ws/index.js:3:19)

Most helpful comment

@Noctsyndrome, thank you that helped a ton. I ended up creating a couple aliases based on your solution to make it faster to startup.

Assuming @vue/devtools is installed globally npm i -g @vue/devtools, here are the commands to run the server and the electron app from the terminal (run each in their own tab/window):

node ./node_modules/@vue/devtools/server.js
/usr/local/lib/node_modules/@vue/devtools/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron ./node_modules/@vue/devtools/app.html

All 12 comments

Experiencing the same issue here.

Experiencing same error as well.

Thought maybe it was an old version of node

But running >9.0 and spread operators were introduced in 8.3 it seams.

the same issue

Same issue. FWIW switching the electron dependency back to "electron": "1.7.11" (from the current 1.7.16) and the issue goes away

@dillingham were you able to get any resolution on this issue? I have tried multiple versions of vue-devtools and electron but have been unable to get it to work.

@barrymortenson no luck yet. I tried changing the electron version as @edsharp suggested manually in node_modules/@vue/devtools/package.json and npm install and got the same error when I node_modules/.bin/vue-devtools.. @edsharp how did you get it working? :)

@dillingham

diff --git a/shells/electron/package.json b/shells/electron/package.json
index a2daa4a..e5dac30 100644
--- a/shells/electron/package.json
+++ b/shells/electron/package.json
@@ -20,7 +20,7 @@
   "license": "MIT",
   "dependencies": {
     "cross-spawn": "^5.1.0",
-    "electron": "1.7.16",
+    "electron": "1.7.11",
     "express": "^4.16.2",
     "ip": "^1.1.5",
     "socket.io": "^2.0.4"
diff --git a/shells/electron/yarn.lock b/shells/electron/yarn.lock
index f7482b2..9c9e99d 100644
--- a/shells/electron/yarn.lock
+++ b/shells/electron/yarn.lock
@@ -967,10 +967,10 @@ electron-download@^3.0.1:
     semver "^5.3.0"
     sumchecker "^1.2.0"

[email protected]:
-  version "1.7.16"
-  resolved "https://registry.yarnpkg.com/electron/-/electron-1.7.16.tgz#40e6b5553e3a87ce7ea52eb05f7926bc40cab11c"
-  integrity sha512-k17+2K3hny6g1etWMkWvzEL06yapZGpqG66O3e5vxfzeHT3FgqrNa3xRF7znjaqvWQmmEdGFdSktQADjUZ0gog==
[email protected]:
+  version "1.7.11"
+  resolved "https://registry.yarnpkg.com/electron/-/electron-1.7.11.tgz#993b6aa79e0e79a7cfcc369f4c813fbd9a0b08d9"
+  integrity sha1-mTtqp54OeafPzDafTIE/vZoLCNk=
   dependencies:
     "@types/node" "^7.0.18"
     electron-download "^3.0.1"

I just made that change to package.json, ran yarn then npm start.

Now I think I'm going mad. I reverted to the original, cleaned out and re-ran yarn and npm start and the electron app started no problem. I'd swear I did that at first and it failed in the same way as running vue-devtools.

I agree that the following fails in the same way as you originally found (for 5.1.1):

npm install -g @vue/devtools
vue-devtools

same issue here

a temporary solution,

  1. go to the devtool path ( /node_modules/@vue/devtools ), and run node server.js;
  2. go /node_modules/@vue/devtools/node_modules/electron/dist, open electron app;
  3. drag app.html from /node_modules/@vue/devtools into the electron app;

now it should work.

@Noctsyndrome, thank you that helped a ton. I ended up creating a couple aliases based on your solution to make it faster to startup.

Assuming @vue/devtools is installed globally npm i -g @vue/devtools, here are the commands to run the server and the electron app from the terminal (run each in their own tab/window):

node ./node_modules/@vue/devtools/server.js
/usr/local/lib/node_modules/@vue/devtools/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron ./node_modules/@vue/devtools/app.html

@Noctsyndrome, thank you that helped a ton. I ended up creating a couple aliases based on your solution to make it faster to startup.

Assuming @vue/devtools is installed globally npm i -g @vue/devtools, here are the commands to run the server and the electron app from the terminal (run each in their own tab/window):

node ./node_modules/@vue/devtools/server.js
/usr/local/lib/node_modules/@vue/devtools/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron ./node_modules/@vue/devtools/app.html

I'm using nativescript-vue and I'm trying the following:

I did not install @vue/devtools globally.
node [...]/server.js worked perfectly, but there's no electron folder inside @vue/devtools/node_modules.

I see that electron was installed in my project node_modules folder, so I tried the following:
./node_modules/electron/dist/electron ./node_modules/@vue/devtools/app.html
It returns:

[30665:0414/163804.498813:FATAL:setuid_sandbox_host.cc(157)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that [hidden]/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755.
[1]    30665 trace trap  ./node_modules/electron/dist/electron ./node_modules/@vue/devtools/app.html

I tried running server.js with sudo, but that doesn't work either.

System info:
OS: Debian 10.3 Buster
Node.js: v.10.20.1
npm: 6.14.4
npx: 6.14.4

Was this page helpful?
0 / 5 - 0 ratings