Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

could not find module workspace/server.js

I am trying to launch a gcloud app engine using an example in fast-ai with a model that i developped https://github.com/imiled/google-app-engine and followed the instructions in the fastai web page https://course.fast.ai/deployment_google_app_engine.html

but it does not seem to work it raises the following error when i go to the page:

Error: Server Error The server encountered an error and could not complete your request. Please try again in 30 seconds.

here is the log that i got from the console:

miledismael@cloudshell:~/google-app-engine (classification-276710)$ gcloud app browse
Did not detect your browser. Go to this link to view your app:
https://classification-276710.ew.r.appspot.com
miledismael@cloudshell:~/google-app-engine (classification-276710)$ gcloud app logs tail -s default
Waiting for new log entries...
2020-05-11 22:16:26 default[20200512t001309]  "GET / HTTP/1.1" 500
2020-05-11 22:16:28 default[20200512t001309]  internal/modules/cjs/loader.js:983
2020-05-11 22:16:28 default[20200512t001309]    throw err;
2020-05-11 22:16:28 default[20200512t001309]    ^
2020-05-11 22:16:28 default[20200512t001309]
2020-05-11 22:16:28 default[20200512t001309]  Error: Cannot find module '/workspace/server.js'      at Funct
ion.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)      at Function.Module._load (internal/
modules/cjs/loader.js:862:27)      at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main
.js:74:12)      at internal/main/run_main_module.js:18:47 {
2020-05-11 22:16:28 default[20200512t001309]    code: 'MODULE_NOT_FOUND',
2020-05-11 22:16:28 default[20200512t001309]    requireStack: []
2020-05-11 22:16:28 default[20200512t001309]  }

If anybody could help that would be great thanks

like image 532
ismael miled Avatar asked Oct 19 '25 03:10

ismael miled


1 Answers

The Google Cloud runtime environment for node.js assumes that at start up it should invoke a file called server.js.

If you want to use a different name for your .js file then you can override this default name in either your package.json or app.yaml file.

See https://cloud.google.com/appengine/docs/standard/nodejs/runtime#application_startup

I'm not sure what environment you were running - the fastai web page you linked to doesn't seem to exist now.

But your stack trace looks just like mine, so I'm thinking you probably had the same error as I did - and the fix was to add the start script in package.json.

like image 156
John Barber Avatar answered Oct 20 '25 16:10

John Barber



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!