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

[BUG]WorkPro: ts-node index.ts TSError: ⨯ Unable to compile TypeScript: index.ts:70:19 - error TS2552: Cannot find name 'URL'. Did you mean 'url'? #525

Open
luojingwenaihemiao opened this issue Jul 20, 2024 · 4 comments
Assignees
Labels
workpro Wechaty Puppet Service WorkPro

Comments

@luojingwenaihemiao
Copy link

Please make sure you have read the Wechaty Puppet Service: WorkPro from Wechaty Official Website before you continue writing this issue.

--- YES, I have checked with that already.

Describe the bug

Follow #267 to try the codespace. After command the npm start, it shows up following error log:

$ npm start

[email protected] start
ts-node index.ts

/usr/local/share/nvm/versions/node/v20.15.1/lib/node_modules/ts-node/src/index.ts:859
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
index.ts:70:19 - error TS2552: Cannot find name 'URL'. Did you mean 'url'?

70 const url = new URL(urlStr);
~~~

index.ts:70:9
70 const url = new URL(urlStr);
~~~
'url' is declared here.

at createTSError (/usr/local/share/nvm/versions/node/v20.15.1/lib/node_modules/ts-node/src/index.ts:859:12)
at reportTSError (/usr/local/share/nvm/versions/node/v20.15.1/lib/node_modules/ts-node/src/index.ts:863:19)
at getOutput (/usr/local/share/nvm/versions/node/v20.15.1/lib/node_modules/ts-node/src/index.ts:1077:36)
at Object.compile (/usr/local/share/nvm/versions/node/v20.15.1/lib/node_modules/ts-node/src/index.ts:1433:41)
at Module.m._compile (/usr/local/share/nvm/versions/node/v20.15.1/lib/node_modules/ts-node/src/index.ts:1617:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Object.require.extensions.<computed> [as .ts] (/usr/local/share/nvm/versions/node/v20.15.1/lib/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Function.Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12) {

diagnosticCodes: [ 2552 ]

Info

To Reproduce

Steps to reproduce the behavior:

  1. Go to 监听与输入企业微信登录验证码 #267
  2. Scroll down to '可运行实例'
  3. Click on codespace
  4. run 'nom start' in code space console
  5. See error

Expected behavior

Shows up the QR-code for logging on with Wecom account.

Screenshots

N/A

@luojingwenaihemiao luojingwenaihemiao added the workpro Wechaty Puppet Service WorkPro label Jul 20, 2024
@su-chang
Copy link
Member

相关依赖没有导致

@luojingwenaihemiao
Copy link
Author

luojingwenaihemiao commented Jul 28, 2024 via email

@lspbeyond
Copy link

我也遇到了,没写过node代码,搞了个挫的代替下:

const getQrcodeKey = (urlStr: string) => {
const url = new URL(urlStr);
return url.searchParams.get('key');
}
改成:
const getQrcodeKey = (urlStr: string) => {
const str_begin = "key="
const str_end = "&"
const index_begin = urlStr.indexOf(str_begin);
const index_end = urlStr.indexOf(str_end);
const str_key = urlStr.slice(index_begin+4, index_end)
console.log(str_key)
return str_key

}

@zhongyuanhui
Copy link

[email protected] start
ts-node index.ts

/workspaces/workpro-getting-started/node_modules/ts-node/src/index.ts:859
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
index.ts:70:19 - error TS2552: Cannot find name 'URL'. Did you mean 'url'?

70 const url = new URL(urlStr);
~~~

index.ts:70:9
70 const url = new URL(urlStr);
~~~
'url' is declared here.

at createTSError (/workspaces/workpro-getting-started/node_modules/ts-node/src/index.ts:859:12)
at reportTSError (/workspaces/workpro-getting-started/node_modules/ts-node/src/index.ts:863:19)
at getOutput (/workspaces/workpro-getting-started/node_modules/ts-node/src/index.ts:1077:36)
......

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

No branches or pull requests

5 participants