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

Unexpected token export while attaching vscode to OpenWrt docker container #10584

Open
RajS999 opened this issue Dec 19, 2024 · 1 comment
Open
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers info-needed Issue requires more information from poster

Comments

@RajS999
Copy link

RajS999 commented Dec 19, 2024

I am trying to attache vscode to OpenWrt docker container. I got following error while doing so:

[567 ms] Start: Run in container: /root/.vscode-server/bin/f1a4fb101478ce6ec82fe9627c43efbf9e98c813-legacy/bin/code-server --log debug --force-disable-user-env --server-data-dir /root/.vscode-server --use-host-proxy --telemetry-level all --accept-server-license-terms --host 127.0.0.1 --port 0 --connection-token-file /root/.vscode-server/data/Machine/.connection-token-f1a4fb101478ce6ec82fe9627c43efbf9e98c813-legacy --extensions-download-dir /root/.vscode-server/extensionsCache --start-server --disable-websocket-compression --skip-requirements-check
[791 ms] Container server: /tmp/vscode-remote-containers-server-55d3b18a-4f1d-4464-9518-ff96f48fa3cd.js:5
var Pn=Object.create;var ye=Object.defineProperty;var Ln=Object.getOwnPropertyDescriptor;var Fn=Object.getOwnPropertyNames;var _n=Object.getPrototypeOf,On=Object.prototype.hasOwnProperty;var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ge=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Fn(t))!On.call(e,o)&&o!==r&&ye(e,o,{get:()=>t[o],enumerable:!(n=Ln(t,o))||n.enumerable});return e};var L=(e,t,r)=>(r=e!=null?Pn(_n(e)):{},Ge(t||!e||!e.__esModule?ye(r,"default",{value:e,enumerable:!0}):r,e)),$n=e=>Ge(ye({},"__esModule",{value:!0}),e);var ve=h((ki,Ye)=>{Ye.exports=function(t,r,n){t(r),n&&n(r===!0?null:r)}});var X=h((qi,Ke)=>{"use strict";var Ve=ve();Ke.exports=function(t,r){if(!t)return function(o,i){return o?Ve(i,o,r):i(!0)};Array.isArray(t)||(t=Object.keys(t).map(function(o){return t[o]}));var n=0;return function(o,i){if(o)return Ve(i,o,r);n>=t.length?i(!0):i(null,t[n++])}}});var Qe=h((Si,Z

SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:617:28)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3
[796 ms] Error reading shell environment.
[796 ms] Error: stream ended with:0 but wanted:9
        at l (/home/perception3/.vscode/extensions/ms-vscode-remote.remote-containers-0.394.0/dist/extension/extension.js:27:22149)
        at /home/perception3/.vscode/extensions/ms-vscode-remote.remote-containers-0.394.0/dist/extension/extension.js:27:22330
        at s (/home/perception3/.vscode/extensions/ms-vscode-remote.remote-containers-0.394.0/dist/extension/extension.js:30:5371)
        at Socket.<anonymous> (/home/perception3/.vscode/extensions/ms-vscode-remote.remote-containers-0.394.0/dist/extension/extension.js:30:5541)
        at Socket.emit (node:events:531:35)
        at endReadableNT (node:internal/streams/readable:1696:12)
        at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
[796 ms] Start: Run in container: mkdir -p '/tmp/devcontainers-b0770876-8494-414a-9226-a4e1a4ef2dc71734622132516' && cat > '/tmp/devcontainers-b0770876-8494-414a-9226-a4e1a4ef2dc71734622132516/env-loginInteractiveShell.json' << 'envJSON'
[797 ms] Container server terminated (code: 1, signal: null).
[797 ms] Container server terminated early. Not reconnecting.
[798 ms] 
[798 ms] 
[873 ms] /root/.vscode-server/bin/f1a4fb101478ce6ec82fe9627c43efbf9e98c813-legacy/out/server-main.js:3
 *--------------------------------------------------------*/var hp=function(e,t){return hp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,i){s.__proto__=i}||function(s,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(s[n]=i[n])},hp(e,t)};export function __extends(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");hp(e,t);function s(){this.constructor=e}e.prototype=t===null?Object.create(t):(s.prototype=t.prototype,new s)}export var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(t[r]=s[r])}return t},__assign.apply(this,arguments)};export function __rest(e,t){var s={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(e!=null&&typeof Object.getOw

SyntaxError: Unexpected token export
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:617:28)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3
[878 ms] Command failed: /root/.vscode-server/bin/f1a4fb101478ce6ec82fe9627c43efbf9e98c813-legacy/bin/code-server --log debug --force-disable-user-env --server-data-dir /root/.vscode-server --use-host-proxy --telemetry-level all --accept-server-license-terms --host 127.0.0.1 --port 0 --connection-token-file /root/.vscode-server/data/Machine/.connection-token-f1a4fb101478ce6ec82fe9627c43efbf9e98c813-legacy --extensions-download-dir /root/.vscode-server/extensionsCache --start-server --disable-websocket-compression --skip-requirements-check
[878 ms] /root/.vscode-server/bin/f1a4fb101478ce6ec82fe9627c43efbf9e98c813-legacy/out/server-main.js:3
 *--------------------------------------------------------*/var hp=function(e,t){return hp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,i){s.__proto__=i}||function(s,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(s[n]=i[n])},hp(e,t)};export function __extends(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");hp(e,t);function s(){this.constructor=e}e.prototype=t===null?Object.create(t):(s.prototype=t.prototype,new s)}export var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(t[r]=s[r])}return t},__assign.apply(this,arguments)};export function __rest(e,t){var s={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(e!=null&&typeof Object.getOw

SyntaxError: Unexpected token export
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:617:28)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3

The full error log is attached.

vscode-openwrt-attach-error.log

Here are versions of various tools:

  • VSCode Version: 1.95.3
  • Local OS Version: Ubuntu 22.04
  • Remote OS Version: OpenWrt 19.07
  • Remote Extension/Connection Type: Dev Containers

Steps to Reproduce:

Running OpenWrt 19.07 docker container:

$ docker pull openwrt/rootfs:x86-64-openwrt-19.07

$ docker run --rm -d --network=host --privileged -p 22:22/tcp -p 443:443/tcp -p 80:80/tcp openwrt/rootfs:x86-64-openwrt-19.07 tail -f /dev/null

$ docker exec -it 2930d1654e6d091d036b2b818dab9c1f3c2acf6a1f03a5e1664d4711c77915c8 sh 

Attaching vscode gives several errors. I resolved many of them with following commands:

/ # mkdir -p /var/lock
/ # chown root:root /var/lock
/ # chmod 755 /var/lock
/ # opkg update
/ # opkg install libustream-openssl ca-bundle ca-certificates
/ # wget https://update.code.visualstudio.com/latest/server-linux-x64/stable
/ # mkdir /root/.vscode-server/
/ # tar -xvzf vscode-server-linux-x64.tar.gz -C /root/.vscode-server/
/ # opkg install tar
/ # opkg install node
/ # node --version
v8.16.1
/ # cp /usr/bin/node /root/.vscode-server/bin/f1a4fb101478ce6ec82fe9627c43efbf9e98c813-legacy 
/ # opkg install git gnupg

Now attaching vscode gives the stated error, which I am unable to resolve.

@vs-code-engineering vs-code-engineering bot added the containers Issue in vscode-remote containers label Dec 19, 2024
@chrmarti
Copy link
Contributor

Is the /tmp/vscode-remote-containers-server-*.js file incomplete?

@chrmarti chrmarti added bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster labels Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug containers Issue in vscode-remote containers info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants