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

Angular v17: Uncaught ReferenceError: process is not defined #121

Open
pras-bot opened this issue Mar 20, 2024 · 3 comments
Open

Angular v17: Uncaught ReferenceError: process is not defined #121

pras-bot opened this issue Mar 20, 2024 · 3 comments

Comments

@pras-bot
Copy link

I am using 'twilio-taskrouter' v2.0.3 npm package in Angular v17 app.
Getting error on accessing the app from browser:

    at node_modules/util/util.js (util.js:109:1)
    at __require (chunk-ZTDPENTR.js?v=8eb4eef9:38:50)
    at 6464 (index.window.js:3:115268)
    at r2 (index.window.js:3:119424)
    at 5600 (index.window.js:3:108312)
    at r2 (index.window.js:3:119424)
    at 568 (index.window.js:3:95429)
    at r2 (index.window.js:3:119424)
    at 6427 (index.window.js:3:97502)
    at r2 (index.window.js:3:119424)

I have debugged this further, twilio-taskrouter is importing 'util' package, which tries to access the (Node) 'process' variable:

if (process.env.NODE_DEBUG) {
  var debugEnv = process.env.NODE_DEBUG;
  debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&')
    .replace(/\*/g, '.*')
    .replace(/,/g, '$|^')
    .toUpperCase();
  debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');
}
@andreasonny83
Copy link
Contributor

Hello @pras-bot.
Thanks for highlighting this.
From what I can see, there's no mention of process.env inside the distribution folder of the [email protected] package.
I'm assuming your errors might come from a TypeScript compiler when processing the third party modules in use by the twilio-taskrouter package.
I would suggest you to enable the skipLibCheck flag under your tsconfig.json and see if that helps in mitigating the problem.
Also, since you mention the problem is showing when consuming twilio-taskrouter v2.0.3, can you please specify if the same problem is also visible when reverting the package to an older version?

Please, let me know if that worked.

@GhazanfarKhan
Copy link

@andreasonny83 I am also getting same error with 2.0.6 version. My angular version is 17 and skipLibCheck is enabled in tsconfig.json. Need help

@GhazanfarKhan
Copy link

Any update we have to update package in our project stuck in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants