代码传送失败并出现错误 - 您必须在 angular-cli 项目中才能使用服务命令

code ship fails with error - You have to be inside an angular-cli project in order to use the serve command

对于我的 angular CLI/Bitbucket 项目,我 运行 在 Codeship 中遵循脚本,但它给出了错误 You have to be inside an angular-cli project in order to use the serve command.

#install node version, 4.x is required for the angular-cli
nvm install 4.1

#install angular-cli
npm install angular-cli 

#run npm install for your project dependencies
npm install

该脚本下面是 "Test Pipelines",其中脚本设置为 运行 测试。

#serve the application adding '&' to run command in background
ng serve &

#start end to end tests using protractor
ng test

#if all of the tests pass, then build the production assets
ng build -prod  

根据 https://github.com/angular/angular-cli/issues/4379,如果您使用(现已弃用)angular-cli 包,通常会触发此错误消息。

更新项目的 package.json 文件以引用 @angular/cli 包,或者确保安装此包而不是已弃用的包。