如果我尝试运行以下命令,则会发生这种情况:
ng serve
An unhandled exception occurred: No projects support the 'serve' target.
See "/tmp/ng-YKKFYj/angular-errors.log" for further details.
在同一目录中,即angular.json,package.json,src文件夹等所在的位置,请参见:
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.
版本:
$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
该项目可以为Android构建。
答案 0 :(得分:1)
您应该使用Schematics进行代码共享项目,该项目可以完成Web和iOS / Android的所有设置。
如果您是通过模板创建的,则可能必须手动配置该项目以支持Web。