SyntaxError: Unexpected end of input on VMware Linux VM despite successful installation
Hello,
I am experiencing a persistent runtime error when trying to run claude after a successful installation. The issue occurs across multiple Node.js versions and with both npm and yarn package managers.
Environment:
- OS: Linux (running on a VMware Virtual Platform)
- NVM: I am using
nvmto manage Node versions. - Node Versions Tested: v18.20.8, v20.19.3, v22.17.0
- Package Managers Tested:
npmandyarn
Problem Description:
The installation (both npm install -g and yarn global add) completes without any critical errors. However, when I run the claude command, it immediately fails with SyntaxError: Unexpected end of input.
Diagnostics and Evidence:
The file seems to be downloaded, has a valid size, and correct permissions, but the Node.js runtime fails to parse it.
- File Path:
``bash``
$ readlink -f $(which claude)
/home/software/.config/yarn/global/node_modules/@anthropic-ai/claude-code/cli.js
- File Stats: (The file size is 7.6 MB, so it's not empty)
``bash``
$ ls -l /home/software/.config/yarn/global/node_modules/@anthropic-ai/claude-code/cli.js
-rwxr-xr-x 1 software software 7661788 Jul 3 12:36 /home/software/.config/yarn/global/node_modules/@anthropic-ai/claude-code/cli.js
- End of File Content: (
tailshows a valid end to an ES module)
``bash),process.exit(1);else if(W.length===1){let J=W[0];await H1("tengu_mcp_delete",{name:I,scope:J}),FH1(I,J),process.stdout.write(
$ tail /home/software/.config/yarn/global/node_modules/@anthropic-ai/claude-code/cli.js
Removed MCP server "${I}" from ${J} config),process.exit(0)}else process.stderr.write(
MCP server "${I}" exists in multiple scopes:),W.forEach((J)=>{process.stderr.write(
- ${JH1(J)})}),process.stderr.write(
),W.forEach((J)=>{process.stderr.write(
To remove from a specific scope, use:
claude mcp remove "${I}" -s ${J})}),process.exit(1)}catch(Z){process.stderr.write(
${Z.message}),process.exit(1)}}),Q.command("list").description("List configured MCP servers").helpOption("-h, --help","Display help for command").action(async()=>{await H1("tengu_mcp_list",{});let I=SV();if(Object.keys(I).length===0)console.log("No MCP servers configured. Use
claude mcp add to add a server.");else for(let[G,Z]of Object.entries(I))if(Z.type==="sse")console.log(${G}: ${Z.url} (SSE));else if(Z.type==="http")console.log(${G}: ${Z.url} (HTTP));else if(!Z.type||Z.type==="stdio"){let D=Array.isArray(Z.args)?Z.args:[];console.log(${G}: ${Z.command} ${D.join(" ")})}process.exit(0)}),Q.command("get <name>").description("Get details about an MCP server").helpOption("-h, --help","Display help for command").action(async(I)=>{await H1("tengu_mcp_get",{name:I});let G=XH1(I);if(!G)console.error(No MCP server found with name: ${I}),process.exit(1);if(console.log(${I}:),console.log( Scope: ${JH1(G.scope)}),G.type==="sse"){if(console.log(" Type: sse"),console.log( URL: ${G.url}),G.headers){console.log(" Headers:");for(let[Z,D]of Object.entries(G.headers))console.log( ${Z}: ${D})}}else if(G.type==="http"){if(console.log(" Type: http"),console.log( URL: ${G.url}),G.headers){console.log(" Headers:");for(let[Z,D]of Object.entries(G.headers))console.log( ${Z}: ${D})}}else if(G.type==="stdio"){console.log(" Type: stdio"),console.log( Command: ${G.command});let Z=Array.isArray(G.args)?G.args:[];if(console.log( Args: ${Z.join(" ")}),G.env){console.log(" Environment:");for(let[D,Y]of Object.entries(G.env))console.log( ${D}=${Y})}}console.log(),process.exit(0)}),Q.command("add-json <name> <json>").description("Add an MCP server (stdio or SSE) with a JSON string").option("-s, --scope <scope>","Configuration scope (local, user, or project)","local").helpOption("-h, --help","Display help for command").action(async(I,G,Z)=>{try{let D=Ru(Z.scope),Y=O8(G),W=Y&&typeof Y==="object"&&"type"in Y?String(Y.type||"stdio"):"stdio";await H1("tengu_mcp_add",{scope:D,source:"json",type:W}),Te1(I,G,D),console.log(
To remove this server, run: claude mcp remove "${I}" -s ${G.scope}Added ${W} MCP server ${I} to ${D} config),process.exit(0)}catch(D){console.error(D.message),process.exit(1)}}),Q.command("add-from-claude-desktop").description("Import MCP servers from Claude Desktop (Mac and WSL only)").option("-s, --scope <scope>","Configuration scope (local, user, or project)","local").helpOption("-h, --help","Display help for command").action(async(I)=>{try{let G=Ru(I.scope),Z=P7();H1("tengu_mcp_add",{scope:G,platform:Z,source:"desktop"});let D=Eg2();if(Object.keys(D).length===0)console.log("No MCP servers found in Claude Desktop configuration or configuration file does not exist."),process.exit(0);let{unmount:Y}=G8(lB.default.createElement(NQ,null,lB.default.createElement(zg2,{servers:D,scope:G,onDone:()=>{Y()}})),{exitOnCtrlC:!0})}catch(G){console.error(G.message),process.exit(1)}}),Q.command("reset-project-choices").description("Reset all approved and rejected project-scoped (.mcp.json) servers within this project").helpOption("-h, --help","Display help for command").action(async()=>{await H1("tengu_mcp_reset_mcpjson_choices",{});let I=o9();$5({...I,enabledMcpjsonServers:[],disabledMcpjsonServers:[],enableAllProjectMcpServers:!1}),console.log("All project-scoped (.mcp.json) server approvals and rejections have been reset."),console.log("You will be prompted for approval next time you start Claude Code."),process.exit(0)}),A.command("migrate-installer").description("Migrate from global npm installation to local installation").helpOption("-h, --help","Display help for command").action(async()=>{if(bT())console.log("Already running from local installation. No migration needed."),process.exit(0);H1("tengu_migrate_installer_command",{}),await new Promise((I)=>{let{waitUntilExit:G}=G8(lB.default.createElement(NQ,null,lB.default.createElement(op,null)));G().then(()=>{I()})}),process.exit(0)}),A.command("doctor").description("Check the health of your Claude Code auto-updater").helpOption("-h, --help","Display help for command").action(async()=>{H1("tengu_doctor_command",{}),await new Promise((I)=>{let{unmount:G}=G8(lB.default.createElement(NQ,null,lB.default.createElement(pE1,{onDone:()=>{G(),I()}})),{exitOnCtrlC:!1})}),process.exit(0)}),A.command("update").description("Check for updates and install if available").helpOption("-h, --help","Display help for command").action(tg2),A.command("install [target]").description("Install Claude Code native build. Use [target] to specify version (stable, latest, or specific version)").option("--force","Force installation even if already installed").helpOption("-h, --help","Display help for command").action(async(I,G)=>{await sT(aT(),"default",!1,!1),await new Promise((Z)=>{let D=[];if(I)D.push(I);if(G.force)D.push("--force");eg2.call(()=>{Z(),process.exit(0)},{},D)})}),await A.parseAsync(process.argv),A}function dj5(){(process.stderr.isTTY?process.stderr:process.stdout.isTTY?process.stdout:void 0)?.write(\x1B[?25h${tR1})}bj5();export{kj5 as showSetupScreens,sT as setup,yj5 as completeOnboarding};
```
The Runtime Error:
This is the exact error I receive when running claude:
...
...
:!0,get:function(){return NO6.registerAdminService}});var qO6=UJ1();Object.defineProperty(R5,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return qO6.BaseSubchannelWrapper}});var Sn0=LJ1();Object.defineProperty(R5,"createServerCredentialsWithInterceptors",{enumerable:!0,get:function(){return Sn0.createServerCredentialsWithInterceptors}});Object.defineProperty(R5,"createCertificateProviderServerCredentials",{enumerable:!0,get:function(){return Sn0.createCertificateProviderServerCredentials}});var $O6=Mn0();Object.defineProperty(R5,"FileWatcherCertificateProvider",{enumerable:!0,get:function(){return $O6.FileWatcherCertificateProvider}});var LO6=Ro();Object.defineProperty(R5,"createCertificateProviderChannelCredentials",{enumerable:!0,get:function(){return LO6.createCertificateProviderChannelCredentials}});var MO6=dc1();Object.defineProperty(R5,"SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX",{enumerable:!0,get:function(){return MO6.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX}})});var yn0=z((jn0)=>{Objec
SyntaxError: Unexpected end of input
at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:152:18)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:299:14)
at async link (node:internal/modules/esm/module_job:67:21)
Node.js v18.20.8
software@software-VMware-Virtual-Platform:~$
Conclusion:
The contradiction between the error message (Unexpected end of input) and the actual file content (which appears to have a valid ending) strongly suggests that the cli.js file is getting corrupted during the installation process specifically within my VMware environment.
Thank you for your help.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗