2017-03-09 143 views
1

我試圖將我的angular2應用程序部署到pivotal cloud foundry,我按照說明找到了here但我一直在收到Loading...,開發者控制檯中沒有發現任何錯誤。在pcf中部署angular2應用程序

/d/gitmyworkspace/mywork/pcfdeploy/src 
$ npm install --quite 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]^1.0.0 (node_modules\chokidar\node_modules\fsevents): 
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) 
/d/gitmyworkspace/mywork/pcfdeploy/src 
$ cf push -b staticfile_buildpack ang-pcf-dep 
Creating app ang-pcf-dep in org ORG/space development as myDetails...OK 
Creating route ang-pcf-dep.domain.com... OK 
Binding ang-pcf-dep.domain.com to ang-pcf-dep... OK 
Uploading ang-pcf-dep... 
Uploading app files from: D:\gitmyworkspace\mywork\pcfdeploy\src 
Uploading 12.9K, 18 files Done uploading OK 
Starting app ang-pcf-dep in org ORG/space development as myDetails... 
Downloading staticfile_buildpack...Downloaded staticfile_buildpack 
Creating container Successfully created container Downloading app package... 
Downloaded app package (6.4K) Staging... 
-------> Buildpack version 1.3.6 
Downloaded [file:///tmp/buildpacks/5d1fcb59173496506d68186968a7b83f/dependencies/https___pivotal-buildpacks.s3.amazonaws.com_concourse-binaries_nginx_nginx-1.9.14-linux-x64.tgz] 
grep: Staticfile: No such file or directory 
-----> Using root folder 
-----> Copying project files into public/ 
-----> Setting up nginx 
grep: Staticfile: No such file or directory 
grep: Staticfile: No such file or directory 
Exit status 0 
Staging complete 
Uploading droplet, build artifacts cache... 
Uploading build artifacts cache... 
Uploading droplet... 
Uploaded build artifacts cache (107B) 
Uploaded droplet (2.5M) 
Uploading complete 
1 of 1 instances running 
App started OK 
App ang-pcf-dep was started using this command `sh boot.sh` 
Showing health and status for app ang-pcf-dep in org ORG /spacedevelopment as myDetails ... OK 
requested state: started 
instances: 1/1 
usage: 1G x 1 instances 
urls: ang-pcf-dep.domain.com 
last uploaded: Thu Mar 9 18:53:22 UTC 2017 
stack: cflinuxfs2 
buildpack: staticfile_buildpack 
state  since     cpu memory  disk   details 
#0 running 2017-03-09 10:53:34 AM 0.0% 3.2M of 1G 6.9M of 1G 

在瀏覽器,它只是加載index.html而不是其他組件,如app.component.html。我剛剛使用webstorm AngularClinode 6.9.5創建了一個基本應用程序來測試pcf deployment。請讓我知道如果我錯過了什麼?

回答

3

對於AngularCli我們該做下面的步驟...

$ng build 
$ cd dist 
$ cf push -b staticfile_buildpack ang-pcf-dep 

請注意,AngularCli你應該從dist文件夾推不appsrc文件夾和圖像等所有的資源文件應該在assets文件夾中。感謝來自pcf的Rob