Typescript TS5042 Build: Option 'project' cannot be mixed with source files on a command line

前端 未结 7 982
北恋
北恋 2021-02-18 22:23

I am receiving the following error across all typescript projects that I am trying run.

TS5042  Build: Option \'project\' cannot be mixed with source files on a          


        
7条回答
  •  攒了一身酷
    2021-02-18 23:12

    The tsc command can be run in two ways:

    1. With a project parameter, which points to the directory that contains a tsconfig.json. For example: tsc --project ./app. The location of the tsconfig.json determines the set of files that should be included in the compilation. See here for more about the tsconfig.json: http://www.typescriptlang.org/docs/handbook/tsconfig-json.html
    2. With a list of files as the default parameter. For example: tsc MyFile1.ts MyFile2.ts MyFile3.ts.

    These two options are incompatible with each other because they both attempt to define which files should be compiled.

    What is the command you are using to compile your project? Or are you using an IDE that runs the build for you?

    Here's the reference for the tsc compiler options.

提交回复
热议问题