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

Failed to launch dev server on Windows #52

Closed
MatteoGauthier opened this issue Apr 24, 2021 · 40 comments
Closed

Failed to launch dev server on Windows #52

MatteoGauthier opened this issue Apr 24, 2021 · 40 comments
Assignees

Comments

@MatteoGauthier
Copy link

Got this error

Started Filesystem GraphQL server on port: 4001
Generating Tina config
Cannot find module 'D:\\Dev\\WebDev\\NextJS\\tina-cloud-starter\\.tina\\__generated__\\temp/schema.js'
Require stack:
- D:\Dev\WebDev\NextJS\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js
- D:\Dev\WebDev\NextJS\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\bin\tina-gql, exiting...
D:\Dev\WebDev\NextJS\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js:1
Error: Cannot find module 'D:\\Dev\\WebDev\\NextJS\\tina-cloud-starter\\.tina\\__generated__\\temp/schema.js'
Require stack:
- D:\Dev\WebDev\NextJS\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js
- D:\Dev\WebDev\NextJS\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\bin\tina-gql
    at compile (D:\Dev\WebDev\NextJS\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js:275:22)
    at async FSWatcher.<anonymous> (D:\Dev\WebDev\NextJS\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js:511:9) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'D:\\Dev\\WebDev\\NextJS\\tina-cloud-starter\\node_modules\\tina-graphql-gateway-cli\\dist\\index.js',
    'D:\\Dev\\WebDev\\NextJS\\tina-cloud-starter\\node_modules\\tina-graphql-gateway-cli\\bin\\tina-gql'
  ]
}
Done in 21.12s.
@DirtyF
Copy link
Contributor

DirtyF commented Apr 26, 2021

Hi Matteo, thanks for sharing. Please detail what leads to this error, your environment, etc. to give more context. We didn't test under Windows yet 😊

@DirtyF
Copy link
Contributor

DirtyF commented Apr 27, 2021

Problem spotted, fix coming soon :)

@logan-anderson
Copy link
Contributor

@MatteoGauthier we had a fix that we thought would resolve the problem but I just tested it and it looks like a new issues has started

Generating Tina config
Cannot find module 'C:\\Users\\Logan\\Documents\\GitHub\\tina-cloud-starter\\.tina\\__generated__\\temp\\schema.js'
Require stack:
- C:\Users\Logan\Documents\GitHub\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js
- C:\Users\Logan\Documents\GitHub\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\bin\tina-gql, exiting...
C:\Users\Logan\Documents\GitHub\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js:1
Error: Cannot find module 'C:\\Users\\Logan\\Documents\\GitHub\\tina-cloud-starter\\.tina\\__generated__\\temp\\schema.js'
Require stack:
- C:\Users\Logan\Documents\GitHub\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js
- C:\Users\Logan\Documents\GitHub\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\bin\tina-gql
    at compile (C:\Users\Logan\Documents\GitHub\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js:275:22)
    at async FSWatcher.<anonymous> (C:\Users\Logan\Documents\GitHub\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js:511:9) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\Logan\\Documents\\GitHub\\tina-cloud-starter\\node_modules\\tina-graphql-gateway-cli\\dist\\index.js',
    'C:\\Users\\Logan\\Documents\\GitHub\\tina-cloud-starter\\node_modules\\tina-graphql-gateway-cli\\bin\\tina-gql'
  ]
}
Done in 23.42s.

any ideas how to fix this one @jeffsee55 ?

@DirtyF
Copy link
Contributor

DirtyF commented May 17, 2021

@logan-anderson I still see double slashes in the path, are you using latest version?
Thought tinacms/tina-graphql-gateway#177 would fix the path on Windows.

@logan-anderson
Copy link
Contributor

I did npm i tina-graphql-gateway So I thought I would be on the latest

@jamespohalloran
Copy link
Contributor

Latest version the CLI too? https://www.npmjs.com/package/tina-graphql-gateway-cli (This might be a dev-dependency)

@logan-anderson
Copy link
Contributor

@jamespohalloran Yes tried on the latest version of that as well.

@logan-anderson logan-anderson self-assigned this May 17, 2021
@logan-anderson
Copy link
Contributor

I think I tracked down the issue. We are not handling windows when using the fast-glob package should have a fix in soon

@logan-anderson
Copy link
Contributor

@MatteoGauthier This should be fixed now on the latest version. Let us know if you run into any more issues and thanks for letting us know about this one.

@abrown2644
Copy link

On Windows as well and getting same error currently

yarn run v1.22.10
$ yarn tina-gql server:start -c "next dev"
$ C:\code\practice\tina-cloud-starter\node_modules\.bin\tina-gql server:start -c "next dev"

Started Filesystem GraphQL server on port: 4001
Generating Tina config
Cannot find module 'C:\\code\\practice\\tina-cloud-starter\\.tina\\__generated__\\temp\\schema.js'
Require stack:
- C:\code\practice\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js
- C:\code\practice\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\bin\tina-gql, exiting...
C:\code\practice\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js:1
Error: Cannot find module 'C:\\code\\practice\\tina-cloud-starter\\.tina\\__generated__\\temp\\schema.js'
Require stack:
- C:\code\practice\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js
- C:\code\practice\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\bin\tina-gql
    at compile (C:\code\practice\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js:276:22)
    at async FSWatcher.<anonymous> (C:\code\practice\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js:519:9) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\code\\practice\\tina-cloud-starter\\node_modules\\tina-graphql-gateway-cli\\dist\\index.js',
    'C:\\code\\practice\\tina-cloud-starter\\node_modules\\tina-graphql-gateway-cli\\bin\\tina-gql'
  ]
}
Done in 11.50s.

@DirtyF
Copy link
Contributor

DirtyF commented Jun 8, 2021

@abrown2644 What version of the tina-graphql package are you using?

@abrown2644
Copy link

@DirtyF I was missing that package actually. Just installed 0.1.12 but same error atm.

@logan-anderson
Copy link
Contributor

@abrown2644 I believe the latest version is 0.2.14 can you try yarn add tina-graphql-gateway@latest and then relaunch the dev server?

@B-Stewart
Copy link

B-Stewart commented Jun 14, 2021

Had to bump to the following to get latest master to work, tina-graphql-gateway wasn't enough. Needed the cli too.

"tina-graphql-gateway-cli": "0.2.45"
"tina-graphql-gateway": "0.2.14"

However, it seems the path it's resolving to isn't correct for non homepage routes. Note the double /content/posts/content/posts

Error: Unable to fetch, errors:
ENOENT: no such file or directory, open 'C:\repos\safely-away-from-the-edge\content\posts\content\posts\voteForPedro.md'

@DirtyF
Copy link
Contributor

DirtyF commented Jun 14, 2021

@B-Stewart right should be content\posts thanks for the feedback. Packages bump is on its way.

@B-Stewart
Copy link

Opened up a new ticket related to my duplicate path issue as it's kinda related to cross platform path handling, but needs to be fixed in the graphql package tinacms/tina-graphql-gateway#259

@DirtyF
Copy link
Contributor

DirtyF commented Jun 15, 2021

We just released a new version of the package @MatteoGauthier and @B-Stewart please upgrade and tell us if that fixes your issue.

@B-Stewart
Copy link

Bumping to "tina-graphql-gateway-cli": "0.2.49" now gives me this error using npm

npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "workspace:": workspace:packages/tina-graphql-helpers

yarn allows me to choose the package to install instead of crashing

Couldn't find any versions for "tina-graphql-helpers" that matches "workspace:packages/tina-graphql-helpers"
? Please choose a version of "tina-graphql-helpers" from this list: 0.0.22

And the duplicate issue tinacms/tina-graphql-gateway#259 is still happening for me when I get it running again using yarn.

@calvary-tucson
Copy link

This might be related. Just forked the repository on Windows and ran yarn install and then yarn dev and got this error:

D:\Development\tina-cloud-starter>yarn dev
yarn run v1.22.10
$ yarn tina-gql server:start -c "next dev"
$ D:\Development\tina-cloud-starter\node_modules\.bin\tina-gql server:start -c "next dev"

Started Filesystem GraphQL server on port: 4001
Generating Tina config
Compiling...
Tina config ======> D:\Development\tina-cloud-starter\.tina\__generated__\config
Building schema...
Generating types...
Typescript types => D:\Development\tina-cloud-starter/.tina/__generated__/types.ts
GraphQL types ====> D:\Development\tina-cloud-starter/.tina/__generated__/schema.gql
node:events:355
      throw er; // Unhandled 'error' event
      ^

Error: spawn next ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:81:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:81:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn next',
  path: 'next',
  spawnargs: [ 'dev' ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@logan-anderson
Copy link
Contributor

@B-Stewart thanks for your report! There was an internal error with the way we where publishing our packages. This should be fixed if you update to the latest versions. I have made a PR that will force this #91.
If you want to upgrade now you can run

yarn upgrade-interactive

and chose all the tina packages.

You can also wait for the PR to me merged and then update your fork.

@calvary-tucson that might be related as well. We will do some internal testing with a windows machine sometime this week. For now you could also try updating and see if the Issue persists.

@calvary-tucson
Copy link

calvary-tucson commented Jun 24, 2021

@logan-anderson
When I click on "Vote for Pedro" I see this error:
image

The other problem I posted about might has something to do with the script command. I think it has something do to with the "-c" of the "yarn tina-gql server:start -c "next dev"" -- I know if I run the commands separately in different command prompts such as "yarn tina-gql server:start" in one and "yarn next dev" in another. Everything seems like it is working. Not sure if this helps.

Tina Dependencies:
"tina-graphql-gateway-cli": "^0.2.51"
"tina-graphql-gateway": "^0.2.17"
"tinacms": "0.41.0"
"final-form": "4.20.1"

@DirtyF DirtyF changed the title Failed to launch dev server Failed to launch dev server on Windows Jun 24, 2021
@ghowardMSD
Copy link

ghowardMSD commented Jun 29, 2021

I just forked from main that includes PR #91 and I'm getting this error on Windows unless I split the commands as in previous post :-

$ yarn tina-gql server:start -c "next dev"
$ D:\Projects\Github\tina-cloud-starter\node_modules\.bin\tina-gql server:start -c "next dev"

Started Filesystem GraphQL server on port: 4001
Visit the playground at http://localhost:4001/altair/
Generating Tina config
Compiling...
Transpiling...
Tina config ======> D:\Projects\Github\tina-cloud-starter\.tina\__generated__\config
Done Compiling...
Generating types...
Typescript types => D:\Projects\Github\tina-cloud-starter/.tina/__generated__/types.ts
GraphQL types ====> D:\Projects\Github\tina-cloud-starter/.tina/__generated__/schema.gql
node:events:353
      throw er; // Unhandled 'error' event
      ^

Error: spawn next ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:269:19)
    at onErrorNT (node:internal/child_process:467:16)
    at processTicksAndRejections (node:internal/process/task_queues:80:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:275:12)
    at onErrorNT (node:internal/child_process:467:16)
    at processTicksAndRejections (node:internal/process/task_queues:80:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn next',
  path: 'next',
  spawnargs: [ 'dev' ]
}

@jeffsee55
Copy link
Member

@ghowardMSD I think you're running into what @calvary-tucson mentioned, you just need to run those commands in separate windows:

yarn tina-gql server:start

And in another terminal:

yarn next dev

@calvary-tucson I think the issue you're seeing is unrelated to the terminal problem, we're likely just not building that path properly, we'll take a look.

@ghowardMSD
Copy link

Yes, it does start ok when I run in separate windows and then I get the Pedro path issue.

@mitchmac
Copy link
Contributor

Poking at the command issue after someone ran into it while checking out Tina, I tried concurrently and it seemed to work:

"dev": "concurrently \"tina-gql server:start\" \"next dev\""

The order of initial output may be a bit confusing though:
Screen Shot 2021-07-16 at 2 47 07 PM

@jeffsee55
Copy link
Member

@mitchmac The problem with concurrently is during CI, we wouldn't know when to shut down the GraphQL server. I believe James was playing around with this a while back but I don't think he got it all the way sorted out.

@mitchmac
Copy link
Contributor

@jeffsee55 Do we actually need to worry about CI right now for this, if we only changed the "dev" command? CI would be using build & export?

@jeffsee55
Copy link
Member

@mitchmac Sure, it's just a pattern. They can also just run two processes.

@jeffsee55
Copy link
Member

Related to tinacms/tinacms#1951

@ghost
Copy link

ghost commented Aug 4, 2021

Concurrently loads the app but renders as 404 and some SSR error using "dev": "concurrently \"tinacms server:start\" \"next dev\"",
image

@logan-anderson
Copy link
Contributor

@mystrdat There was a couple issues with the navigation that have been fixed. Is your Fork up to date with the latest changes in the starter?

@ghost
Copy link

ghost commented Aug 4, 2021

Yes, I just cloned current main. If i yarn install it and run yarn dev, it stops as it does for #52 (comment)

If I run concurrently \"tinacms server:start\" \"next dev\" it loads but fails with the errors in the image above.
If I add tina-graphql-gateway tina-graphql-gateway-cli packages and run concurrently \"tina-gql server:start\" \"next dev\", it fails as follows

[0] Started Filesystem GraphQL server on port: 4001
[0] Visit the playground at http://localhost:4001/altair/
[1] event - compiled successfully
[0] Generating Tina config
[0] Compiling...
[0] Transpiling...
[0] Cannot read property 'collections' of undefined
[0] tina-gql server:start exited with code 0

@logan-anderson
Copy link
Contributor

@mystrdat Thanks for the details. Mind trying concurrently \"tinacms server:start\" \"next dev\ in your scripts instead?

We changed the name of the command to start the server from tina-gql to tinacms

@ghost
Copy link

ghost commented Aug 4, 2021

I did try those, mentioned them above, that results are in the image I posted. It build but 404s on frontend with the SSR errors.

@jeffsee55
Copy link
Member

@mystrdat are you still importing defineSchema from the older tina-graphql-gateway-cli? It should be from @tinacms/cli:

import { defineSchema } from '@tinacms/cli'

@ghost
Copy link

ghost commented Aug 4, 2021

defineSchema is imported from '@tinacms/cli' as you mention, I'm using the latest main where it is as such. I've only tried tina-graphql-gateway-cli because others mentioned it before but that didn't work either.

@jeffsee55
Copy link
Member

Ok just wondering because tina-gql server:start exited with code 0 indicates you're running things with tina-graphql-gateway-cli, tina-gql was our old bin command, tinacms is the new one. The only commands you need are outlined here.

To better debug this, can you run:

yarn tinacms server:start

And checkout `http://localhost:4001/altair. If you see a GraphQL GUI you should be able to run queries on it. That would at least tell us that the GraphQL portion is working.

@ghost
Copy link

ghost commented Aug 4, 2021

That was from when I tried tina-graphql-gateway-cli, I described that in the comment. http://localhost:4001/altair/ works. The main issue I'm facing when running the current repo main with concurrently is in #52 (comment)

@mitchmac
Copy link
Contributor

mitchmac commented Aug 9, 2021

Per @logan-anderson this should be ok but exposes issues deeper into use

@logan-anderson
Copy link
Contributor

The deeper issue should be fixed now as well. Everything should work as expected on windows the same as unix

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

10 participants