0

I have freshly installed Nativescript Angular project using:

ng new --collection=@nativescript/schematics my-mobile-app

command I get from nativescript-schematics

and right after the fresh installation I try it to run on android emulator.

tns run android

then I get this error during compiling:

Searching for devices...
Preparing project...
File change detected. Starting incremental webpack compilation...

webpack is watching the files…

Hash: c018afa003f9a5a7d1cd
Version: webpack 4.44.2
Time: 4451ms
Built at: 11/05/2020 1:54:33 PM
 3 assets
Entrypoint bundle = runtime.js vendor.js bundle.js
[./app.css] 1.05 KiB {bundle} [built]
[./main.ts] 1.13 KiB {bundle} [built]
[~/package.json] external "~/package.json" 42 bytes {bundle} [optional] [built]
    + 331 hidden modules

ERROR in error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option.

1 Answer 1

7

I also got the same error. The way I fixed it was to add "baseUrl": ".", to tsconfig.json

So your tsconfig.json it ends up looking like:

{
  "compilerOptions": {
    "module": "ESNext",
    "target": "es2017",
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "skipLibCheck": true,
    "noEmitHelpers": true,
    "noEmitOnError": true,
    "baseUrl": ".",          // add this line
    "lib": [
      "es2017",
      "dom",
      "es6"
    ]
  },
  "exclude": [
    "node_modules",
    "platforms"
  ]
}

BUT then the next error you might get is:

cp: no such file or directory: E:/NativeScript/my-app/App_Resources/Android/*

So to fix that I moved the App_Resources folder, which was in the app folder, up one level like:

  • from my-app/app/App_Resources
  • to my-app/App_Resources

Then it finally ran correctly!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.