embedded-app-sdk icon indicating copy to clipboard operation
embedded-app-sdk copied to clipboard

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

Open srckat opened this issue 1 year ago • 2 comments

image

srckat avatar Mar 23 '24 08:03 srckat

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

$ pnpm build

> [email protected] 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/[email protected]/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/[email protected]/node_modules/esbuild/lib/main.js:1636:15)
    at /home/kruz/embedded-app-sdk-main/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1048:25
    at /home/kruz/embedded-app-sdk-main/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:993:52
    at buildResponseToResult (/home/kruz/embedded-app-sdk-main/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1046:7)
    at /home/kruz/embedded-app-sdk-main/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1075:16
    at responseCallbacks.<computed> (/home/kruz/embedded-app-sdk-main/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:697:9)
    at handleIncomingPacket (/home/kruz/embedded-app-sdk-main/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:752:9)
    at Socket.readFromStdout (/home/kruz/embedded-app-sdk-main/node_modules/.pnpm/[email protected]/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 avatar Mar 25 '24 23:03 lyghtkruz

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/[email protected]/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.

lyghtkruz avatar Mar 25 '24 23:03 lyghtkruz