错误文件&#xxx'未找到。该文件在程序中是因为:root for sprciped for编译 - nodejs应用程序

发布于 2025-02-07 11:19:04 字数 1354 浏览 0 评论 0原文

我已经陷入了几天的困扰。我检查了几个不同的问题,这些问题与此主题有所联系,但每个解决方案都无法解决问题。 Visual Studio中的错误列表几次在不同的文件中提及此错误(未找到文件'xxx'。文件在程序中,因为:当xxx代表我的nodejs应用程序中指定的编译 - 在我的nodejs应用中指定的root文件file),但是;所有这些文件都存在于错误中提到的目录中! 一个屏幕截图显示了错误和提及的文件,

并 清楚地指出了它的位置要在Local主持的主机上运行该应用程序,它显示了以下内容: Chrome上显示的错误消息的屏幕截图 如您所见,它说它找不到node_modules文件夹下的某些文件(特别是xxx/ansi_html/index.js,我理解,因为它应该是ansi_html_community,因为当我运行不同的不同时会生成ansi_html_community。 NPM命令,但我不知道如何更改)。

在错误列表中,它还指出了自动生成的TS文件的问题(由于某种原因,即使我在INIT运行时没有指定打字稿),

这是我一直关注的YouTube课程的链接:https://www.youtube.com/playlist?list=PLWKjhJtqVAbnadueQ-C5keMQQiQau_i0D

edit: So我是这个课程播放列表的第四次视频。因此创建的寄存器和登录表单以及后端。当我下载Axios时,我收到了许多漏洞,尽管我了解的是对代码本身没有影响的。我认为要添加的另一点是,我在客户端的Node_modules文件夹上有一个奇怪的红色负标志,但是我收到的错误在服务器和客户端端都存在。

这是我的项目与GitHub的链接: https://github.com/github.com/shanisnenisneh/blindtypingapp

请帮助!感谢所有回复的人 PS-我将所有这些错误分组在一起,因为它们似乎以某种方式与同一基本问题有关。我觉得问题与该项目的自动生成有关,也许没有创建正确的事情吗?但是,我试图创建一个新项目,但问题仍然存在。 :'((

I am stuck on this problem for several days already. i checked several different questions that were somewhat linked to this subject but each solution failed to fix the problem. The error list in visual studio mention this error several times with different files(file 'XXX' not found. the file is in the program because: Root file specified for compilation- in my NodeJS app, when XXX stands for the complete path of the file), however; all those files exist in the directory mentioned in the error!
a screenshot showing both the error and the file mentioned clearly where it directs

In addition, when i try to run the application on localhost it shows this:
screenshot of the error messages shown on chrome
where, as you can see, it says it cannot find some files that are under node_modules folder(s)(specifically xxx/ansi_html/index.js, which i understand since it's supposed to be ansi_html_community as was automaticaly generated when i run the different npm commands but i don't know how to change it).

In the list of errors it also states problems with the automatically generated ts files(for some reason, even though i specified no typescript when i run init)

here is a link to the course on youtube which i have been following: https://www.youtube.com/playlist?list=PLWKjhJtqVAbnadueQ-C5keMQQiQau_i0D

edit: So far i am at the 4th video of this course playlist. So created register and login forms as well as the backend. When i downloaded axios i received many vulnerabilities though from what i understood it has no impact on the code itself. Another point i've thought to add is that i have a strange red minus sign on the node_modules folder in the client side but the error i recieve exists both on the server and client side.

here is a link to github with my project: https://github.com/ShaniSneh/blindTypingApp

Please help! Thanks for all who reply <3
P.S.- I grouped all those errors together since they seemed connected to the same underlying problem somehow. I feel like the problem is connected to the auto-generation of the project, maybe something was not created right? However, i have tried to create a new project but the problem persists. :'(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

攒眉千度 2025-02-14 11:19:04

我只是出现相同的错误,很可能是由于在错误目录处运行NPM构建或类似命令而发生的。

关闭所有开放的Visual Studio应用程序,并重新开放它们至少为我解决了问题。

由于您已经陷入了这个问题几天,所以我认为您可能已经尝试了这种方法。如果您设法以其他任何方式解决此问题,或者仍然对您来说仍然是一个问题,请告诉我。

I just had the same error, it most likely occurred because of running the npm build or similar command at the wrong directory.

Closing down all open visual studio apps and reopening them solved the issue for me at least.

Since you have been stuck on this problem for days i assume you might have already tried this approach. Please let me know if you managed to solve this issue in any other way or if it still remains an issue for you.

若无相欠,怎会相见 2025-02-14 11:19:04

如果是打字稿项目=&gt;

  1. 确保OutdirOUTOT tsconfig.json 文件同时提到了JS和TS文件目录。
    例如,如果您的JavaScript文件位于一个名为dist的文件夹中,
    转到tsconfig.js,搜索Outdir =&gt;取消注释代码=&gt;将其更改为“ OutDir”:“ ./dist”
    如果您的打字稿文件在一个名为src的文件夹中,
    搜索rootdir =&gt;取消注释代码=&gt;将其更改为“ rootdir”:“ ./src”
  2. 仅使用tsc命令运行文件,请勿使用tsc index.ts 。

If it's a typescript project =>

  1. Make sure that the outDIR and outRoot in tsconfig.json file have both the js and ts file directories mentioned.
    For example, if your javascript file is in a folder called dist,
    go to tsconfig.js, search for outDir => Uncomment the code => change it to "outDir": "./dist",
    and if your typescript file is in a folder called src,
    search for rootDir => Uncomment the code => change it to "rootDir": "./src",
  2. Run the file just using tsc command, don't run using tsc index.ts.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文