1

I am deploying a Vue.js app to GCP using App Engine and I got this error.

    [Error: Cannot find module '/workspace/server.js'
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
        at Function.Module._load (internal/modules/cjs/loader.js:667:27)
        at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    ]

The app is working fine locally when i use the run serve command.

Here is my app.yaml file


    runtime: nodejs12
    env: standard

and package.json


    {
      "name": "frontend",
      "version": "0.1.0",
      "private": true,
      "main": "./src/main.js",
      "scripts": {
        "serve": "vue-cli-service serve /src/main.js",
        "build": "vue-cli-service build"
      },
      "dependencies": {
        "@fortawesome/fontawesome-svg-core": "^1.2.35",
        "@fortawesome/free-brands-svg-icons": "^5.15.3",
        "@fortawesome/free-solid-svg-icons": "^5.15.3",
        "@fortawesome/vue-fontawesome": "^2.0.2",
        "core-js": "^3.6.5",
        "register-service-worker": "^1.7.1",
        "vue": "^2.6.11",
        "vue-router": "^3.2.0",
        "vuex": "^3.4.0"
      },
      "devDependencies": {
        "@vue/cli-plugin-babel": "~4.5.0",
        "@vue/cli-plugin-pwa": "~4.5.0",
        "@vue/cli-plugin-router": "~4.5.0",
        "@vue/cli-plugin-vuex": "~4.5.0",
        "@vue/cli-service": "^4.5.0",
        "vue-template-compiler": "^2.6.11"
      }
    }

I have tried setting the EntryPoint here in the vue.config.js file


    const path = require('path');
    module.exports = {
        entry: {
            app: './src/main.js'
        }
    }

Please kindly help me resolve this issue.

  • You might need to add the start command in you package.json. Take a look at [this](https://stackoverflow.com/questions/63608035/error-cannot-find-module-workspace-server-js) where there is an answer specifying this and also other answers that can be helpful. – Sergi Jun 21 '21 at 16:12

0 Answers0