2

I have one repository on GitHub. It includes common packages, an API and a web app.

In the API and in the web app I use the common packages. For that I use yarn workspaces. So I can give the common packages a name in their package.json files and then use them by "common-package-name": "*". This works locally.

I have app.yaml files in the API and in the web app directory. I use GitHub actions to deploy the two apps. But I get the following error:

npm ERR! 404 Not Found - GET https://registry.npmjs.org/@bujus%!f(MISSING)common - Not found
npm ERR! 404 
npm ERR! 404  '@bujus/common@*' is not in this registry.
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

@bujus/common is the first common package.

I do not have pushed the common packages to npm registry and do not want to do so. Is there a solution to this?

In addition, I build the app in the GitHub action and thought that Appengine would just execute the start command which would execute the build files in the dist folder, but apparently it wants to install or just check the dependencies.

The root package.json:

{
  "name": "@bujus/root",
  "version": "1.0.0",
  "private": true,
  "license": "UNLICENSED",
  "workspaces": [
    "tool-presets",
    "common",
    "common-frontend",
    "api",
    "school-app"
  ],
  "scripts": {
    "build-development": "turbo run build-development",
    "build-production": "turbo run build-production",
    "lint": "turbo run lint --continue",
    "prettify": "turbo run prettify  --continue",
    "start-development": "turbo run start-development",
    "test": "turbo run test"
  },
  "devDependencies": {
    "@bujus/tool-presets": "*",
    ...
  },
  "packageManager": "yarn@1.22.17"
}

The common package.json

{
  "name": "@bujus/common",
  "version": "1.0.0",
  "license": "UNLICENSED",
  "main": "./dist/common.es.js",
  "scripts": {
    "build-development": "vite build --mode development",
    "build-production": "vite build",
    "lint": "eslint --fix --ext .html,.js .",
    "prettify": "prettier --write \"./**/*.{html,js}\""
  },
  "dependencies": {
    ...
  }
}

The webapp package.json

{
  "name": "@bujus/school-app",
  "version": "1.0.0",
  "license": "UNLICENSED",
  "scripts": {
    "build-production": "vite build",
    "lint": "eslint --fix --ext .html,.js,.jsx .",
    "prettify": "prettier --write \"./**/*.{html,js,jsx}\"",
    "start-development": "vite"
  },
  "dependencies": {
    "@bujus/common": "*",
    "@bujus/common-frontend": "*",
    ...
  }
}
juliushuck
  • 1,398
  • 1
  • 11
  • 25
  • Can you share your `package.json` file? – Catherine O Jun 02 '22 at 05:41
  • @CatherineO I added them – juliushuck Jun 02 '22 at 16:22
  • In your common package.json file, did you try to add `"private": true`? – Catherine O Jun 03 '22 at 07:22
  • I just tried it and now I get: error An unexpected error occurred: "https://registry.yarnpkg.com/@bujus%!f(MISSING)common: Not found". And I think I found a similar question: https://stackoverflow.com/questions/56564517/how-to-deploy-one-app-from-a-large-monorepo-with-dependencies-to-packages-in-the But I do not want to use docker, because then I can not downscale to 0 instances – juliushuck Jun 03 '22 at 12:51
  • I now switched to Cloud Run and Docker with yarn workspaces and turbo repo. Works very good. When sb. needs help, I can post my configurations – juliushuck Sep 08 '22 at 03:49
  • hey @juliushuck I have the same problem, can you post how you get it working plz? – Brozorec Oct 09 '22 at 11:18
  • 1
    @Brozorec Hi, I copied together my configs in this article. It is is not done yet, because I do not really have the time to create an example repository and gcloud setup. Let me now, if you get stuck somewhere. https://medium.com/@juliushuck/run-monorepo-with-api-and-web-app-on-google-cloud-run-yarn-workspaces-turborepo-vite-docker-cb139561c446 – juliushuck Oct 10 '22 at 23:37

0 Answers0