基于jhipster的nhipster服务器启动错误
我正在尝试使用 Jhipster(即 nhipster)生成基于 Angular NestJS 的应用程序。 以下是我的 jhipster 和 nodejs 版本号:
Jhipster : 7.7.0 NodeJS: 16.14.0 LTS
但是当我尝试启动服务器时出现以下错误:
错误:
/projects/nhipster/mauto/server/node_modules/ts-node/src/index.ts:240
return new TSError(diagnosticText, diagnosticCodes)
^
TSError: ⨯ Unable to compile TypeScript:
src/client/header-util.ts:56:19 - error TS2552: Cannot find name 'URL'. Did you mean 'url'?
56 url = new URL('http://localhost' + url);
~~~
src/client/header-util.ts:55:32
55 private static prepareLink(url, pageNumber, pageSize, relType): any {
~~~
'url' is declared here.
at createTSError (/Users/kmadasu/kishore/mnkb/projects/nhipster/mauto/server/node_modules/ts-node/src/index.ts:240:12)
at reportTSError (/Users/kmadasu/kishore/mnkb/projects/nhipster/mauto/server/node_modules/ts-node/src/index.ts:244:19)
at getOutput (/Users/kmadasu/kishore/mnkb/projects/nhipster/mauto/server/node_modules/ts-node/src/index.ts:360:34)
at Object.compile (/Users/kmadasu/kishore/mnkb/projects/nhipster/mauto/server/node_modules/ts-node/src/index.ts:393:11)
at Module.m._compile (/Users/kmadasu/kishore/mnkb/projects/nhipster/mauto/server/node_modules/ts-node/src/index.ts:439:43)
at Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Object.require.extensions.<computed> [as .ts] (/Users/kmadasu/kishore/mnkb/projects/nhipster/mauto/server/node_modules/ts-node/src/index.ts:442:12)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
[nodemon] app crashed - waiting for file changes before starting...
I am trying to generate Angular NestJS based application using Jhipster i.e, nhipster.
Below is my jhipster and nodejs version numbers:
Jhipster : 7.7.0
NodeJS: 16.14.0 LTS
But I am getting the below error, when I am trying to start the server:
Error:
/projects/nhipster/mauto/server/node_modules/ts-node/src/index.ts:240
return new TSError(diagnosticText, diagnosticCodes)
^
TSError: ⨯ Unable to compile TypeScript:
src/client/header-util.ts:56:19 - error TS2552: Cannot find name 'URL'. Did you mean 'url'?
56 url = new URL('http://localhost' + url);
~~~
src/client/header-util.ts:55:32
55 private static prepareLink(url, pageNumber, pageSize, relType): any {
~~~
'url' is declared here.
at createTSError (/Users/kmadasu/kishore/mnkb/projects/nhipster/mauto/server/node_modules/ts-node/src/index.ts:240:12)
at reportTSError (/Users/kmadasu/kishore/mnkb/projects/nhipster/mauto/server/node_modules/ts-node/src/index.ts:244:19)
at getOutput (/Users/kmadasu/kishore/mnkb/projects/nhipster/mauto/server/node_modules/ts-node/src/index.ts:360:34)
at Object.compile (/Users/kmadasu/kishore/mnkb/projects/nhipster/mauto/server/node_modules/ts-node/src/index.ts:393:11)
at Module.m._compile (/Users/kmadasu/kishore/mnkb/projects/nhipster/mauto/server/node_modules/ts-node/src/index.ts:439:43)
at Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Object.require.extensions.<computed> [as .ts] (/Users/kmadasu/kishore/mnkb/projects/nhipster/mauto/server/node_modules/ts-node/src/index.ts:442:12)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
[nodemon] app crashed - waiting for file changes before starting...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“56”行的“URL”函数未正确导入到打字稿模块中。它是来自 typescript 编译器内部 dom 定义的函数。您可以找到一种方法将其导入 header-util 类。另一种方法,我要做的就是在服务器 ts-config 文件的编译器选项中启用“dom”,通过将“dom”添加到 lib 数组中,如下所示:
That "URL" function at your line "56" is not imported into the typescript module properly. It is a function that comes from dom definition inside the typescript compiler. You could find a way to import it into the header-util class. Another way, and what I'd do is enable "dom" in the compiler options in the ts-config file of the server, by adding "dom" to the lib array like so: