Deploying Angular 2 (quickstart app) to Google Clo

2020-04-21 04:25发布

问题:

I was trying to deploy the simplest project on Google Cloud platform. The quickstart project can be found here. Locally it works without issues.

However it gets more complicated to get it working on Google Cloud. I know there are a lot of other providers like Heroku with 1-click deployment, but I found it weird that it's not so easy to do it with Google service.

App.yaml

runtime: nodejs
env: flex

Package.json - as provided in quickstart project here

The first error I get while deploying (gclould app deploy):

angular-quickstart@1.0.0 start /app
tsc && concurrently "tsc -w" "lite-server"
sh: 1: tsc: not found

Then I add to package.json:

"preinstall": "npm install tsc",

The second error:

tsc && concurrently "tsc -w" "lite-server"
error TS5023: Unknown compiler option 'moduleResolution'.
error TS5023: Unknown compiler option 'lib'.

Here I am lost.

Of course I'm using location that supports flex.

Any ideas if I'm digging the problem in right way or I should just recreate my project using simple tutorial found at codelabs.developers.google.com/codelabs/cloud-cardboard-viewer/

回答1:

You can use the flex environment if you have any server side code e.g you have written specific server logic to CURD objects. For client side code you will be better off deploying static files into google storage