"npm run build" fails, on packaged/non-cloned version

Issue #1128 resolved
Igor created an issue

Hello, I downloaded the latest stable release (v2.41.2, from https://bitbucket.org/geowerkstatt-hamburg/masterportal/downloads/?tab=tags), installed via npm install and tried to run npm run build, but the build command fails with:

npm run build

/tmp/masterportal/geowerkstatt-hamburg-masterportal-8e3a3a992823/node_modules/git-rev-sync/index.js:20
      throw new Error('[git-rev-sync] failed to execute command: ' + result.stderr + '/' + result.error);
      ^

Error: [git-rev-sync] failed to execute command: fatal: not a git repository (or any of the parent directories): .git
/undefined
    at _command (/tmp/masterportal/geowerkstatt-hamburg-masterportal-8e3a3a992823/node_modules/git-rev-sync/index.js:20:13)
    at Object.tag (/tmp/masterportal/geowerkstatt-hamburg-masterportal-8e3a3a992823/node_modules/git-rev-sync/index.js:130:10)
    at getMastercodeVersionFolderName (/tmp/masterportal/geowerkstatt-hamburg-masterportal-8e3a3a992823/devtools/tasks/getMastercodeVersionFolderName.js:9:28)
    at Object.<anonymous> (/tmp/masterportal/geowerkstatt-hamburg-masterportal-8e3a3a992823/devtools/tasks/replace.js:4:115)
    at Module._compile (node:internal/modules/cjs/loader:1155:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
    at Module.load (node:internal/modules/cjs/loader:1033:32)
    at Function.Module._load (node:internal/modules/cjs/loader:868:12)
    at Module.require (node:internal/modules/cjs/loader:1057:19)
    at require (node:internal/modules/cjs/helpers:103:18)

Running on linux, Node.js is v16.18.1

Is the masterportal supported as simple archive, or must it be downloaded as a git repository?

Comments (15)

  1. Konstantin Holm

    Hello Igor,

    I believe the Masterportal must be downloaded as a git repository. I have cloned the repo on my Linux machine and was able to successfully build.

    Can you try cloning the repository properly and building it again? If that doesn’t work, I will look deeper into it.

    Also I do not know how your machine behaves, in my case I had to run sudo npm run build for it to build.

    Sincerely,

    Konstantin Holm

  2. Igor reporter

    Hi Konstantin, thank you for trying on your machine.
    I tried by cloning the repository and, yes, I can confirm that the build successfully runs.

    The source was fetched from Bitbucket Download page, by a script used to handle library upgrades: this option is a lot faster because the zip archive is only ~7MB; cloning the repository requires about 140MB, plus ~0.6GB for node_modules.
    The single reason for cloning seems to allow Husky to use pre-push Git hook, for the case of a dev wanting to commit on the repository. That’s why I thought that the compressed source would work for non-dev users.

    Unfortunately there’s no distribution version of Masterportal (while that’s the case for the Masterpotal-API, that provides either a dist minified version inside the repo, plus is available on NPM); I was wondering if Masterportal has plans to provide a built version without requiring the cloning and manual build.

  3. Konstantin Holm

    I see, but all in all your issue has been resolved, yes?

    Regarding your question if a Masterportal Build Version without cloning and manual build is possible, maybe @Inka Dudek can help?

  4. Igor reporter

    Yes, the build-fail issue is unblocked, thank you Konstantin.

    I'm curious to understand more about the build process without Git.

    (I have additional questions regarding the build, but is the Issues section the right place to discuss aspects or ask support?)

  5. Igor reporter

    Ach so, thanks for pointing that out @Inka Dudek !

    So npm run build prompts to input the portals-path, only to copy those as additional examples into the dist directory?
    (I see the content of portal folder is always copied either way)

    Is it only for to prepare the examples.zip or is there an additional purpose? (e.g. bundling additional custom code into the build)

  6. Inka Dudek

    npm run build prompts to input the portals-path: copies the content of the input to dist dir.

    We use ist to deploy several portals from another folder than masterportal/portals.

    It produces the distribution version of the masterportal what is used also in the examples. It adapts all paths in the contents of the portals-folder to the created distribution version.

  7. Log in to comment