简体   繁体   English

如何使用 tsconfig.json 修复此错误

[英]How do I fix this error with tsconfig.json

I'm running the npm run dev script for this one node.js website and it's launching the website locally but giving me this error:我正在为这个 node.js 网站运行npm run dev脚本,它在本地启动网站但给我这个错误:

PS C:\Users\yairk\OneDrive\Desktop\personal-website-3D-main> npm run dev

> dev
> webpack serve --config ./bundler/webpack.dev.js

Project running at:
  - http://192.168.0.168:8080
  - http://localhost:8080
<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] On Your Network (IPv4): http://192.168.0.168:8080/
<i> [webpack-dev-server] Content not from webpack is served from 'C:\Users\yairk\OneDrive\Desktop\personal-website-3D-main\static' directory
<i> [webpack-dev-middleware] wait until bundle finished: /
ERROR in ./src/script.ts 
[tsl] ERROR
      TS18002: The 'files' list in config file 'tsconfig.json' is empty.

ERROR in ./src/script.ts
Module build failed (from ./node_modules/ts-loader/index.js):
Error: error while parsing tsconfig.json
    at Object.loader (C:\Users\yairk\OneDrive\Desktop\personal-website-3D-main\node_modules\ts-loader\dist\index.js:17:18)

webpack compiled with 2 errors

I can't seem to find the tsconfig.json file in the folders and I'm not sure how I would be able to fix this as the website still runs but with these 2 errors.我似乎无法在文件夹中找到 tsconfig.json 文件,而且我不确定如何解决这个问题,因为网站仍在运行,但出现了这两个错误。

The error is misleading.该错误具有误导性。 You're missing a tsconfig.json file in the root directory of your project.您在项目的根目录中缺少 tsconfig.json 文件。

Here is a sample template with include instead of files : https://github.com/realm/node-template-project/blob/master/tsconfig.json这是一个include而不是files的示例模板: https://github.com/realm/node-template-project/blob/master/tsconfig.json

This directive tells TypeScript where are *.ts files located.该指令告诉 TypeScript *.ts 文件位于何处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM