Darius Biro
Darius Biro

Reputation: 189

I have a error after adding nativescript to an angular project

I had a working angular project, and wanted to try NativeScript, so I added NativeScript to it using npm install --global @nativescript/schematics and ng add @nativescript/schematics but now when I try to run ng serve I get this error

ERROR in error TS6053: File 'C:[path]/src/src/main.ts' not found.

error TS6053: File 'C:[path]/src/src/polyfills.ts' not found.

I tried deleting node_modlues, and running npm install again, but the error is the same. I even tried restarting my terminal and run ng serve again and the result is the same

Did I do something wrong? Or did i forget to do something?

EDIT

tsconfig.app.json file:

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "types": [],
    "paths": {
      "@src/*": [
        "src/*.web",
        "src/*"
      ]
    }
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ],
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ]
}

Upvotes: 1

Views: 447

Answers (3)

Fatme
Fatme

Reputation: 121

Another way to fix this is to change the location of main file inside angular.json -> "main": "src/main.ts"

Upvotes: 0

Fatme
Fatme

Reputation: 121

It seems as a problem with paths or files properties inside tsconfig.app.json. Can you paste it here to check if this is the case?

Upvotes: 1

Allabakash
Allabakash

Reputation: 2027

Remove the keyword 'src/' from the paths mentioned in the files array and try. checkout this - https://github.com/NativeScript/nativescript-schematics/issues/240 Hope this helps.

Upvotes: 1

Related Questions