Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nhost init.. fails on Microsoft Windows (not supported) #18

Closed
baggsie opened this issue May 2, 2020 · 29 comments
Closed

nhost init.. fails on Microsoft Windows (not supported) #18

baggsie opened this issue May 2, 2020 · 29 comments

Comments

@baggsie
Copy link

baggsie commented May 2, 2020

Hello,

On windows 10:

C:\Users\petes\Sandpit\nhost2>hasura version
INFO hasura cli                                    version=v1.2.0

C:\Users\petes\Sandpit\nhost2>nhost init -d test-app
'command' is not recognized as an internal or external command,
operable program or batch file.
 »   Warning: Hasura CLI is a dependency. Please follow the instructions here https://hasura.io/docs/1.0/graphql/manual/hasura-cli/install-hasura-cli.html
(node:2476) SyntaxError Plugin: nhost: C:\Users\petes\AppData\Local\nhost\version: Unexpected end of JSON input
module: @oclif/config@1.15.1
task: runHook init
plugin: nhost
root: C:\Users\petes\AppData\Roaming\nvm\v12.16.1\node_modules\nhost
See more details with DEBUG=*

C:\Users\petes\Sandpit\nhost2>
@elitan
Copy link
Contributor

elitan commented May 2, 2020

@baggsie Hi! Yes, right now the Hasura CLI is a dependency you must have on your system.

The current dependencies are:

  • Hasura CLI
  • Docker
  • Docker Compose

We will make this more clear in the future.

@elitan elitan closed this as completed May 2, 2020
@baggsie
Copy link
Author

baggsie commented May 2, 2020

Hi @elitan

I have the dependencies already installed:

C:\Users\petes>docker -v
Docker version 19.03.8, build afacb8b

C:\Users\petes>docker-compose version
docker-compose version 1.25.4, build 8d51620a
docker-py version: 4.1.0
CPython version: 3.7.4
OpenSSL version: OpenSSL 1.1.1c  28 May 2019

C:\Users\petes>hasura version
INFO hasura cli                                    version=v1.2.0

@nunopato
Copy link
Contributor

nunopato commented May 2, 2020

@baggsie Unfortunatelty, we only support *nix systems at the moment.. Support for Windows is in the roadmap!

@nunopato nunopato reopened this May 2, 2020
@nunopato nunopato self-assigned this May 2, 2020
@baggsie
Copy link
Author

baggsie commented May 2, 2020

OK, thanks for your help.

@baggsie baggsie closed this as completed May 2, 2020
@nunopato
Copy link
Contributor

nunopato commented May 2, 2020

@baggsie thank you for writing to us! I will leave this issue open, so we can better track current known issues, and update the title to reflect Windows support.

@nunopato nunopato reopened this May 2, 2020
@nunopato nunopato changed the title nhost init.. failing due to Hasura CLI dependency error nhost init.. fails on Microsoft Windows (not supported) May 2, 2020
@jiftuq
Copy link

jiftuq commented Feb 19, 2021

What should I do if I use Windows for migrations and metadata?

@akd-io
Copy link

akd-io commented Jun 13, 2021

I managed to get nhost init running with Ubuntu from the Microsoft Store. nhost dev is still giving me trouble though.

Full setup steps:

  • Install Ubuntu from the Microsoft Store.
  • Run sudo apt update and sudo apt upgrade.
  • Locate project folder in /mnt/c
  • Run export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin to exclude /mnt/c binaries. Reasoning can be found here.
  • Install Node.js. You probably want to do this via nvm. I ended up installing it via the install commands from the NodeSource Node.js Binary Distributions though:
    (Do not install via apt. It initially gave me Node 10 which resulted in issue nhost init fails when trying to access userData.user.teams #29)
    curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
    sudo apt-get install -y nodejs
  • Run sudo npm install -g --unsafe-perm=true --allow-root hasura-cli to install the Hasura CLI. (--unsafe-perm=true and --allow-root used to prevent this error)
  • Run sudo npm install -g nhost to install the Nhost CLI.
  • Run sudo nhost login to login.
  • Run sudo nhost init to initialize Nhost project.

Currently working to get nhost dev working.
I managed to get docker and docker-compose setup using Docker Desktop's and its WSL 2 integration.
However, sudo nhost dev gets stuck when trying to set permissions on the /var/lib/postgresql/data directory.
The log for sudo nhost dev can be found here: https://gist.github.com/akd-io/cd1d5177be947c4985f3c8f97670cfd0
Might be related to #61, I'm unsure.

@nunopato nunopato removed this from To do in Nhost Jun 14, 2021
@henry-huynh-3508
Copy link

any updates on this issue?

@MarcelloTheArcane
Copy link

@henry-huynh-3508 Can you use WSL2?

@jiftuq
Copy link

jiftuq commented Aug 9, 2021

@akd-io Thanks man

@jiftuq
Copy link

jiftuq commented Aug 9, 2021

I keep getting this error:
Email Confirmed! You are now logged in.
Error!
Could not read auth file. Run nhost login first.
Error: EACCES: permission denied, open '/home/chris/.nhost/auth.json.2814139651'
Code: EACCES

Even though Im login

@mrinalwahal
Copy link
Contributor

The new CLI (>= v0.5.0) is supported on Windows.

Note: New CLI is only meant to be used with Nhost v2. Which is still under beta testing.

I'm closing this issue.

@vipafattal
Copy link

vipafattal commented Aug 24, 2022

I followed the same steps using wsl2 with Ubuntu 20.04.04 LTS and when using the command nhost up I'm facing the following issue "container for service "postgres" is unhealthy".

Here is the full log:

nhost up -d
Initializing Hasura client
You are using 20.10.16 version of docker engine. Please upgrade to 20.10.17 or higher version.
Upgrade instructions: https://docs.docker.com/engine/install/

start timeout is set to 10m0s
Stopping docker compose
Starting docker compose
Starting functions
Starting postgres, graphql-engine containers...
Start took 7.068142491s

[exit status 1
Container catalog-server-app-peaceful_grothendieck-postgres-1 Creating
Container catalog-server-app-peaceful_grothendieck-postgres-1 Created
Container catalog-server-app-peaceful_grothendieck-graphql-engine-1 Creating
Container catalog-server-app-peaceful_grothendieck-graphql-engine-1 Created
Container catalog-server-app-peaceful_grothendieck-postgres-1 Starting
Container catalog-server-app-peaceful_grothendieck-postgres-1 Started
Container catalog-server-app-peaceful_grothendieck-postgres-1 Waiting
container for service "postgres" is unhealthy
] Failed to start services

@Salman9000
Copy link

Did u find a solution?

@vipafattal
Copy link

Yes hopefully I managed to get nhost dev to work, just use WSL with ubuntu 20.04.4 LTS and follow the same steps by akd-io

Did u find a solution?

@abhishekhar001
Copy link

I followed the same steps using wsl2 with Ubuntu 20.04.04 LTS and when using the command nhost up I'm facing the following issue "container for service "postgres" is unhealthy".

Here is the full log:

nhost up -d
Initializing Hasura client
You are using 20.10.16 version of docker engine. Please upgrade to 20.10.17 or higher version.
Upgrade instructions: https://docs.docker.com/engine/install/

start timeout is set to 10m0s
Stopping docker compose
Starting docker compose
Starting functions
Starting postgres, graphql-engine containers...
Start took 7.068142491s

[exit status 1
Container catalog-server-app-peaceful_grothendieck-postgres-1 Creating
Container catalog-server-app-peaceful_grothendieck-postgres-1 Created
Container catalog-server-app-peaceful_grothendieck-graphql-engine-1 Creating
Container catalog-server-app-peaceful_grothendieck-graphql-engine-1 Created
Container catalog-server-app-peaceful_grothendieck-postgres-1 Starting
Container catalog-server-app-peaceful_grothendieck-postgres-1 Started
Container catalog-server-app-peaceful_grothendieck-postgres-1 Waiting
container for service "postgres" is unhealthy
] Failed to start services

i am also getting this same problem

@abhishekhar001
Copy link

managed

can you please explain more. because i have installed this but still not working

@vipafattal
Copy link

Did you try to run nhost dev instead? It seems to work

@abhishekhar001
Copy link

Did you try to run nhost dev instead? It seems to work

yes. but it is not working. can you please help me?? how can i contact you??

@abhishekhar001
Copy link

did you followed this full process??

I managed to get nhost init running with Ubuntu from the Microsoft Store. nhost dev is still giving me trouble though.

Full setup steps:

  • Install Ubuntu from the Microsoft Store.
  • Run sudo apt update and sudo apt upgrade.
  • Locate project folder in /mnt/c
  • Run export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin to exclude /mnt/c binaries. Reasoning can be found here.
  • Install Node.js. You probably want to do this via nvm. I ended up installing it via the install commands from the NodeSource Node.js Binary Distributions though:
    (Do not install via apt. It initially gave me Node 10 which resulted in issue nhost init fails when trying to access userData.user.teams #29)
    curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
    sudo apt-get install -y nodejs
  • Run sudo npm install -g --unsafe-perm=true --allow-root hasura-cli to install the Hasura CLI. (--unsafe-perm=true and --allow-root used to prevent this error)
  • Run sudo npm install -g nhost to install the Nhost CLI.
  • Run sudo nhost login to login.
  • Run sudo nhost init to initialize Nhost project.

Currently working to get nhost dev working. I managed to get docker and docker-compose setup using Docker Desktop's and its WSL 2 integration. However, sudo nhost dev gets stuck when trying to set permissions on the /var/lib/postgresql/data directory. The log for sudo nhost dev can be found here: https://gist.github.com/akd-io/cd1d5177be947c4985f3c8f97670cfd0 Might be related to #61, I'm unsure.

@vipafattal
Copy link

did you followed this full process??

I managed to get nhost init running with Ubuntu from the Microsoft Store. nhost dev is still giving me trouble though.
Full setup steps:

  • Install Ubuntu from the Microsoft Store.
  • Run sudo apt update and sudo apt upgrade.
  • Locate project folder in /mnt/c
  • Run export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin to exclude /mnt/c binaries. Reasoning can be found here.
  • Install Node.js. You probably want to do this via nvm. I ended up installing it via the install commands from the NodeSource Node.js Binary Distributions though:
    (Do not install via apt. It initially gave me Node 10 which resulted in issue nhost init fails when trying to access userData.user.teams #29)
    curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
    sudo apt-get install -y nodejs
  • Run sudo npm install -g --unsafe-perm=true --allow-root hasura-cli to install the Hasura CLI. (--unsafe-perm=true and --allow-root used to prevent this error)
  • Run sudo npm install -g nhost to install the Nhost CLI.
  • Run sudo nhost login to login.
  • Run sudo nhost init to initialize Nhost project.

Currently working to get nhost dev working. I managed to get docker and docker-compose setup using Docker Desktop's and its WSL 2 integration. However, sudo nhost dev gets stuck when trying to set permissions on the /var/lib/postgresql/data directory. The log for sudo nhost dev can be found here: https://gist.github.com/akd-io/cd1d5177be947c4985f3c8f97670cfd0 Might be related to #61, I'm unsure.

Yes I think I followed this one and some other links I couldn't recall but mainly to set up the ubuntu, could you share what error you are getting with nhost dev?

@abhishekhar001
Copy link

[exit status 1
Container catalog-server-app-peaceful_grothendieck-postgres-1 Creating
Container catalog-server-app-peaceful_grothendieck-postgres-1 Created
Container catalog-server-app-peaceful_grothendieck-graphql-engine-1 Creating
Container catalog-server-app-peaceful_grothendieck-graphql-engine-1 Created
Container catalog-server-app-peaceful_grothendieck-postgres-1 Starting
Container catalog-server-app-peaceful_grothendieck-postgres-1 Started
Container catalog-server-app-peaceful_grothendieck-postgres-1 Waiting
container for service "postgres" is unhealthy
] Failed to start services

i am getting this error

@vipafattal
Copy link

Can you have a look and see if this works for you #373

@thomas-cruz
Copy link

Is there a work around that works for windows 11? I followed the steps above and it broke on installing hasura-cli

@dbarrosop
Copy link
Contributor

yes, you can use wsl2.

@thomas-cruz
Copy link

I am using wsl2.
I followed this

I managed to get nhost init running with Ubuntu from the Microsoft Store. nhost dev is still giving me trouble though.

Full setup steps:

* Install [Ubuntu](https://www.microsoft.com/store/productId/9NBLGGH4MSV6) from the Microsoft Store.

* Run `sudo apt update` and `sudo apt upgrade`.

* Locate project folder in `/mnt/c`

* Run `export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin` to exclude `/mnt/c` binaries. Reasoning can be found [here](https://github.com/microsoft/WSL/issues/3882).

* Install Node.js. You probably want to do this via [nvm](https://github.com/nvm-sh/nvm). I ended up installing it via the install commands from the [NodeSource Node.js Binary Distributions](https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions) though:
  (Do not install via apt. It initially gave me Node 10 which resulted in issue [nhost init fails when trying to access userData.user.teams #29](https://github.com/nhost/cli/issues/29))
  ```shell
  curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
  sudo apt-get install -y nodejs
  ```

* Run `sudo npm install -g --unsafe-perm=true --allow-root hasura-cli` to install the Hasura CLI. (`--unsafe-perm=true` and `--allow-root` used to prevent [this error](https://stackoverflow.com/questions/38323880/error-eacces-permission-denied))

* Run `sudo npm install -g nhost` to install the Nhost CLI.

* Run `sudo nhost login` to login.

* Run `sudo nhost init` to initialize Nhost project.

Currently working to get nhost dev working. I managed to get docker and docker-compose setup using Docker Desktop's and its WSL 2 integration. However, sudo nhost dev gets stuck when trying to set permissions on the /var/lib/postgresql/data directory. The log for sudo nhost dev can be found here: https://gist.github.com/akd-io/cd1d5177be947c4985f3c8f97670cfd0 Might be related to #61, I'm unsure.

I get to installing hasura-cli and I get this

npm ERR! Error: Cannot find module 'C:\Users\Tom\AppData\Roaming\nvm\v18.14.1\node_modules\hasura-cli\dist\index.js'
npm ERR!     at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
npm ERR!     at Module._load (node:internal/modules/cjs/loader:920:27)
npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
npm ERR!     at node:internal/main/run_main_module:23:47 {
npm ERR!   code: 'MODULE_NOT_FOUND',
npm ERR!   requireStack: []
npm ERR! }

@dbarrosop
Copy link
Contributor

Please, follow the instructions here: https://github.com/nhost/cli?tab=readme-ov-file#get-started

@thomas-cruz
Copy link

I've followed those and it didn't work, which is why I'm here. To be honest your responses haven't helped.

@dbarrosop
Copy link
Contributor

I have tried to help to the best of my abilities given the information provided. The instructions you initially pasted are not correct, hence, why I pointed you to the correct ones. If the official instructions aren't working feel free to provide more details on where things are failing and any error you may be receiving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests