discord / embedded-app-sdk

🚀 The Discord Embedded App SDK lets you build rich, multiplayer experiences as Activities inside Discord.
https://discord.com/developers/docs/activities/overview
MIT License
1.27k stars 179 forks source link

'The define key "process.env.ProgramFiles(x86)" contains invalid identifier "ProgramFiles(x86)"' #60

Open techsideofficial opened 8 months ago

techsideofficial commented 8 months ago

image

lyghtkruz commented 8 months ago

I'm running into the same issue on Alma Linux:

$ pnpm build

> nested-messages@1.0.0 build /home/kruz/embedded-app-sdk-main/examples/nested-messages
> node ./scripts/build.js

✘ [ERROR] The define key "process.env.BASH_FUNC_which%%" contains invalid identifier "BASH_FUNC_which%%"

/home/kruz/embedded-app-sdk-main/node_modules/.pnpm/esbuild@0.17.11/node_modules/esbuild/lib/main.js:1636
  let error = new Error(`${text}${summary}`);
              ^

Error: Build failed with 1 error:
error: The define key "process.env.BASH_FUNC_which%%" contains invalid identifier "BASH_FUNC_which%%"
    at failureErrorWithLog (/home/kruz/embedded-app-sdk-main/node_modules/.pnpm/esbuild@0.17.11/node_modules/esbuild/lib/main.js:1636:15)
    at /home/kruz/embedded-app-sdk-main/node_modules/.pnpm/esbuild@0.17.11/node_modules/esbuild/lib/main.js:1048:25
    at /home/kruz/embedded-app-sdk-main/node_modules/.pnpm/esbuild@0.17.11/node_modules/esbuild/lib/main.js:993:52
    at buildResponseToResult (/home/kruz/embedded-app-sdk-main/node_modules/.pnpm/esbuild@0.17.11/node_modules/esbuild/lib/main.js:1046:7)
    at /home/kruz/embedded-app-sdk-main/node_modules/.pnpm/esbuild@0.17.11/node_modules/esbuild/lib/main.js:1075:16
    at responseCallbacks.<computed> (/home/kruz/embedded-app-sdk-main/node_modules/.pnpm/esbuild@0.17.11/node_modules/esbuild/lib/main.js:697:9)
    at handleIncomingPacket (/home/kruz/embedded-app-sdk-main/node_modules/.pnpm/esbuild@0.17.11/node_modules/esbuild/lib/main.js:752:9)
    at Socket.readFromStdout (/home/kruz/embedded-app-sdk-main/node_modules/.pnpm/esbuild@0.17.11/node_modules/esbuild/lib/main.js:673:7)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:315:12) {
  errors: [
    {
      detail: undefined,
      id: '',
      location: null,
      notes: [],
      pluginName: '',
      text: 'The define key "process.env.BASH_FUNC_which%%" contains invalid identifier "BASH_FUNC_which%%"'
    }
  ],
  warnings: []
}
 ELIFECYCLE  Command failed with exit code 1.
lyghtkruz commented 8 months ago

After grepping through the code, I couldn't find the problematic which function. Checking my environment, it appears my system has a weird "which" function defined:

]$ env | grep -i which
which_declare=declare -f
BASH_FUNC_which%%=() {  ( alias;
 eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@

]$ which which
which ()
{
    ( alias;
    eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@
}

After unsetting the variable, I was able to run the build and I came up with a different error now.

✘ [ERROR] Could not resolve "../utils/MessageInterface"

    client/nested/old/index.ts:1:31:
      1 │ import {MessageInterface} from '../utils/MessageInterface';
        ╵                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~

/home/kruz/embedded-app-sdk-main/node_modules/.pnpm/esbuild@0.17.11/node_modules/esbuild/lib/main.js:1636
  let error = new Error(`${text}${summary}`);
              ^

Error: Build failed with 1 error:
client/nested/old/index.ts:1:31: ERROR: Could not resolve "../utils/MessageInterface"

You might have a weird environment variable that is causing a similar error. The MessageInterface is supposed to be a class defined in the example code, so I am going to dig around some more and will post if I find a solution.

--- edit I had moved the index.html and index.ts from the sample code to try to put my own page up, that's why it couldn't find the class. Everything built properly once I put it back.