ForestG
ForestG

Reputation: 18085

Nativescript project cannot run ng serve

If I try to run the following command, this happens:

ng serve
An unhandled exception occurred: No projects support the 'serve' target.
See "/tmp/ng-YKKFYj/angular-errors.log" for further details.

in the same directory, where the angular.json, the package.json, src folder etc. is, see:

forest@forest:~/<project-path>$ ls -lsa
total 380
  4 drwxrwxr-x   8 forest forest   4096 dec   17 17:44 .
  4 drwxrwxr-x   7 forest forest   4096 dec   17 16:20 ..
  4 -rw-r--r--   1 forest forest    383 okt   26  1985 angular.json
  4 drwxrwxr-x   4 forest forest   4096 dec   12 14:16 App_Resources
  4 -rw-r--r--   1 forest forest    202 okt   26  1985 .editorconfig
  4 -rw-r--r--   1 forest forest    260 dec   17 15:43 .gitignore
  4 drwxrwxr-x   5 forest forest   4096 dec   17 14:02 hooks
  4 drwxr-xr-x   3 root   root     4096 dec   13 15:41 .idea
 12 -rw-r--r--   1 forest forest  11368 okt   26  1985 LICENSE
 20 drwxrwxr-x 567 forest forest  20480 dec   17 16:15 node_modules
  4 -rw-r--r--   1 forest forest     62 okt   26  1985 nsconfig.json
  4 -rw-rw-r--   1 forest forest   1315 dec   17 16:15 package.json
264 -rw-rw-r--   1 forest forest 267877 dec   17 16:15 package-lock.json
  4 drwxrwxr-x   3 forest forest   4096 dec   17 16:04 platforms
  4 drwxrwxr-x   4 forest forest   4096 dec   17 15:26 src
  4 -rw-r--r--   1 forest forest    670 dec   17 16:34 tsconfig.json
  4 -rw-r--r--   1 forest forest    126 okt   26  1985 tsconfig.tns.json
  4 -rw-r--r--   1 forest forest     38 okt   26  1985 tsfmt.json
  4 -rw-rw-r--   1 forest forest   3093 dec   17 17:44 tslint.json
  4 -rw-r--r--   1 forest forest   1575 dec   12 18:16 tslint_old.json
 16 -rw-rw-r--   1 forest forest  14103 dec   17 13:23 webpack.config.js
forest@forest:~/<project-path>$ ng serve
An unhandled exception occurred: No projects support the 'serve' target.                                                                                                                                           
See "/tmp/ng-dO1bgr/angular-errors.log" for further details.                                                                                                                                                       

Versions:

$ng --version:
Angular CLI: 8.3.19
Node: 12.3.1
OS: linux x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.803.19 (cli-only)
@angular-devkit/core         8.2.2
@angular-devkit/schematics   8.3.19 (cli-only)
@ngtools/webpack             8.2.2
@schematics/angular          8.3.19 (cli-only)
@schematics/update           0.803.19 (cli-only)
rxjs                         6.5.3
typescript                   3.5.3
webpack                      4.27.1

$tns --version
6.2.2

The project can be build for Android though.

Upvotes: 1

Views: 840

Answers (1)

Manoj
Manoj

Reputation: 21898

You should use Schematics for code sharing project which does all the setup for Web and iOS / Android.

If you had created it from template, you might have to manually configure the project to support web.

Upvotes: 2

Related Questions