[Angular-CLI-6]Could not determine single project for 'Serve' target

有些话、适合烂在心里 提交于 2019-12-05 07:20:54

Did you follow all three steps of the update process?

The update generally follows 3 steps, and will take advantage of the new ng update tool.

1) Update @angular/cli:

npm install -g @angular/cli
npm install @angular/cli
ng update @angular/cli

2) Update your Angular framework packages:

ng update @angular/core

3) Update other dependencies

See toward the bottom of this post for more information: https://blog.angular.io/version-6-of-angular-now-available-cc56b0efa7a4

See also this link for the set of steps: https://update.angular.io/

Angular 6 has a feature added known as library. I just upgraded my universal project from angular 4 to 6 which lead to the error above in my case the problem was the script below:

    "build:client-and-server-bundles": "ng build --prod && ng run project-name:server:production",

I fixed it by amending my project name to the script as below:

    "build:client-and-server-bundles": "ng build my-main-project-name --prod && ng run my-main-project-name:server:production",

So the change was with build command so now your ng build --prod command will be changed to ng build --prod my-main-project-name due to library you can have multiple project without letting them interfere with one another. So you'll need to specify the project you want to build.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!