Installation on windows

Hello,
I am a web developer for Editoria in Tirana, and I am currently installing Editoria Booksprints on Windows pc.
I am following the installation guide and after installing Node, Docker and Yarn I am not sure for the next step [https://gitlab.coko.foundation/editoria/booksprints#install-dependencies](Install Dependencies) . Maybe the description is a little misleading, but I’m not sure what dependencies to install or how to do it on windows, because this guide actually does cover only linux environment. Thank you :slight_smile:

2 Likes

Hey @dmerizaj welcome!

Pubsweet apps development on windows have always been complicated.

Right now, your best option is to set up windows subsystem for linux 2
https://zcom.tech/install-wsl2-windows-10.html/ and install following the readme.

(I would also check docker specific install for WSL2 https://docs.docker.com/docker-for-windows/wsl-tech-preview/)

1 Like

good questions @dmerizaj !! keep them coming! if you work out how to get it up on windows can you document your findings here too for others? thanks!

Thanks for the suggestion @julien. I tried installing the WSL2 as you suggested and the steps were as below:
Firstly, I needed to upgrade windows 10 to Windows 10 20H1 preview build 18917 or later.

Downloading and installing the latest build took too much time . This build also requires you to enroll to Windows Insider Preview program, which may cause the pc other issues, bugs, because windows features are not fully tested yet (because that’s what insider program is about).

After that, I followed this instructions on how to enable and install Linux distro:

- https://docs.microsoft.com/en-us/windows/wsl/install-win10

- https://docs.microsoft.com/en-us/windows/wsl/install-manual#download-using-curl

- https://docs.microsoft.com/en-us/windows/wsl/install-manual#installing-your-distro

- https://docs.microsoft.com/en-us/windows/wsl/initialize-distro

I installed Ubuntu 12.04

Again I want to mention that the effort to install it and the expertise needed is to be considered!

After installing Ubuntu, I followed the steps to install editoria as described on the documentation: https://gitlab.coko.foundation/editoria/booksprints#editoria-booksprints

Installation from Windows Bash
  • open cmd
    • C:…\ > bash

    • Install node ( Node.js v12.x) :

          $ # Using Ubuntu
          $ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
          $ sudo apt-get install -y nodejs
      
    • If you install from a package manager (this is the case) your bin may be called nodejs so you just need to symlink it like so:

        $ ln -s /usr/bin/nodejs /usr/bin/node
      
    • Install NVM
      https://github.com/nvm-sh/nvm#install--update-script

       $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash   
       $ nvm install 8.6     #required Node version >= 8.6
      
    • Install npm:

         $ sudo apt-get install npm
      
    • Edit $PATH on ~./profile :

         $ nano ~/.profile
         PATH="$HOME/bin:$HOME/.local/bin:/usr/bin:$PATH"
         $ source ~/.profile
      
    • Clone Editoria Booksprints:

           $ git clone https://gitlab.coko.foundation/editoria/booksprints.git 
           $ cd booksprints
      
    • Install Yarn:

            $ sudo npm install -g 
            $ yarn 
      
      • In this Step occurs this error :
        gyp ERR! build error
        gyp ERR! stack Error: make failed with exit code: 2
        gyp ERR! stack at ChildProcess.onExit (/mnt/c/Users/“Donald”/desktop/projects/editoria/booksprints/node_modules/node-gyp/lib/build.js:262:23)
        gyp ERR! stack at ChildProcess.emit (events.js:311:20)
        gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
        gyp ERR! System Linux 4.4.0-17134-Microsoft
        gyp ERR! command “/home/dmerizaj/.nvm/versions/node/v12.16.1/bin/node” “/mnt/c/Users/“path to”/editoria/booksprints/node_modules/node-gyp/bin/node-gyp.js” “build” “–fallback-to-build” “–module=/mnt/c/Users/“path to”/editoria/booksprints/node_modules/bcrypt/lib/binding/bcrypt_lib.node” “–module_name=bcrypt_lib” “–module_path=/mnt/c/Users/“path to”/editoria/booksprints/node_modules/bcrypt/lib/binding” “–napi_version=5” “–node_abi_napi=napi” “–napi_build_version=0” “–node_napi_label=node-v72”
        gyp ERR! cwd /mnt/c/User/“path to”/editoria/booksprints/node_modules/bcrypt
        gyp ERR! node -v v12.16.1
        gyp ERR! node-gyp -v v3.8.0
        gyp ERR! not ok
        node-pre-gyp ERR! build error
        node-pre-gyp ERR! stack Error: Failed to execute ‘/home/dmerizaj/.nvm/versions/node/v12.16.1/bin/node /mnt/c/Users/“path to”/editoria/booksprints/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/mnt/c/Users//“path to”/editoria/booksprints/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/mnt/c/Users/“path to”/editoria/booksprints/node_modules/bcrypt/lib/binding --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72’ (1)

Is this happening to anyone else and what should I do in this case, because I couln’t find any working solution!

The long installation of Windows 10 20H1 is not something we can fix,
the part of making Editoria able to be installed in windows normally may be possible in the in the future .

1 Like

i see you have node v12.16.1
can you try to make it v12.13.0

1 Like

I overcome the error by deleting “node_modules” folder on booksprints and run again

$yarn.

$ yarn policies set-version berr
$ yarn

  • Now another error happens:

Error: substance@git+https://gitlab.coko.foundation/wax/substance-fork#master isn’t supported by any available resolver
at t.MultiResolver.getResolverByDescriptor (/mnt/c/Users/“path”/editoria/booksprints/.yarn/releases/yarn-berry.js:24:42880)
at t.MultiResolver.bindDescriptor (/mnt/c/Users/“path”/editoria/booksprints/.yarn/releases/yarn-berry.js:24:42334)
at /mnt/c/Users/“path”/editoria/booksprints/.yarn/releases/yarn-berry.js:36:587690
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Promise.all (index 636)
at async K.resolveEverything (/mnt/c/Users/“path”/editoria/booksprints/.yarn/releases/yarn-berry.js:36:587013)
at async /mnt/c/Users/“path”/editoria/booksprints/.yarn/releases/yarn-berry.js:36:603869
at async p.startTimerPromise (/mnt/c/Users/“path”/editoria/booksprints/.yarn/releases/yarn-berry.js:24:46853)
at async K.install (/mnt/c/Users/“path”/editoria/booksprints/.yarn/releases/yarn-berry.js:36:603481)

  • I also downgraded the node version to 12.13.0 @danjelashehi, but this did not affect the new error above.

This is reiterating the comments above to a certain extent, but for posterity’s sake, I’m gathering it all here.

Pubsweet requires a *nix system to work (macos or any linux distribution), so development on windows is not directly supported.
This means that pubsweet development (editoria included) on windows will require running a linux system within windows somehow.

There are a number of options for how to do this:

  • As @julien said, the latest windows builds have wsl2, which is an integrated lightweight linux vm inside windows. As you mentioned, this requires you to be in the insiders program, which is pretty much windows’ unstable branch. I personally have been doing that for a few months with only minor issues.
  • You can run a linux VM manually and pretty much emulate what wsl2 is doing. This is more work for the same thing really, but it doesn’t require getting off of windows’ stable branch.
  • You can run the application with docker, which will get linux for you and run the app within it.

Windows updates are notorious for their slow speed, but that really is a fact that windows users need to live with, since there isn’t anything that can be done about it as far as I know (apart from waiting for their next major release - 10X). As @danjelashehi mentioned, this is really beyond the scope of pubsweet and editoria.

On Ubuntu, I’d strongly recommend that you switch to a newer LTS version, as 12.04 is quite old (April 2012). 18.04 should be a better choice. If you’re using WSL2, you can grab Ubuntu 18 from the app store.

1 Like

This seems to be a valid url (https://gitlab.coko.foundation/wax/substance-fork).

I suspect this might be a reason:

Did you have a specific reason to manually change yarn’s policies?

Thanks @yannis for your detailed explanation.
Regarding this command " yarn policies set-version berr " I was trying to update yarn version following https://yarnpkg.com/getting-started/install , because the latest official package version is 1.22.0, but on the editoria documenation it is suggested to use yarn version > 1.3 .

1.22 is larger than 1.3, so that should be fine.
If only to at least rule yarn out as a cause, can you

Again, highly recommended that you use something newer than Ubuntu 12.

1 Like

ohh, I was reading it as yarn 1.2.2 actually :confused: . I Installed Ubuntu 18.04 and I started the process all over again, with the right versions of node and yarn, but the error now is this:

error An unexpected error occurred: “ENOENT: no such file or directory, lstat ‘/home/dmerizaj/.cache/yarn/v6/npm-knex-0.16.5-8ba3806289a5d543dd42ed21420a31c578476993-integrity/node_modules/knex/src/dialects/redshift/query’”

Which step exactly is giving you that error?

When I try to install yarn dependecies:

$ yarn

did you install yarn before installing yarn dependencies ?
from what i understood above you removed yarn, so you install it again and then install dependencies with it

@danjelashehi I executed the commands as follows:

$ yarn install
$ yarn

As was defined on the editoria installation documentation.

1 Like

@dmerizaj what are the outputs of node -v and yarn --version in your new installation?

I tried installing the dependencies and it went fine.

Here is my setup (windows with wsl2):

yannis: ~ > lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:        18.04
Codename:       bionic

yannis: ~ > node -v
v8.16.0

yannis: ~ > yarn --version
1.21.1

Here are the commands I ran:

git clone https://gitlab.coko.foundation/editoria/booksprints.git
cd booksprints
yarn install
1 Like

@dmerizaj adding on what other have said, have you also sourced the env file before running yarn? In our experience, if you don’t source it before running yarn you will have issues?

That means the step should be:

git clone https://gitlab.coko.foundation/editoria/booksprints.git
cd booksprints
--- create the .env file under the config folder---
source config/(filename of your .env config)
yarn install
1 Like

Thanks @yannis, so this is my output :

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
.
$ node -v
v12.13.1
.
$ yarn --version
1.22.0

But after adding .env file, as @kominoshja suggested, it finally worked! So I cloned the repo again as below:

And the dependecies installed successfully !

2 Likes