tina-cloud-starter icon indicating copy to clipboard operation
tina-cloud-starter copied to clipboard

Failed to launch dev server on Windows

Open MatteoGauthier opened this issue 3 years ago • 40 comments

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.

MatteoGauthier avatar Apr 24 '21 18:04 MatteoGauthier

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 avatar Apr 26 '21 07:04 DirtyF

Problem spotted, fix coming soon :)

DirtyF avatar Apr 27 '21 17:04 DirtyF

@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 ?

logan-anderson avatar May 17 '21 12:05 logan-anderson

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

DirtyF avatar May 17 '21 12:05 DirtyF

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

logan-anderson avatar May 17 '21 12:05 logan-anderson

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

jamespohalloran avatar May 17 '21 12:05 jamespohalloran

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

logan-anderson avatar May 17 '21 13:05 logan-anderson

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 avatar May 17 '21 14:05 logan-anderson

@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.

logan-anderson avatar May 28 '21 12:05 logan-anderson

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.

abrown2644 avatar Jun 08 '21 02:06 abrown2644

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

DirtyF avatar Jun 08 '21 07:06 DirtyF

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

abrown2644 avatar Jun 08 '21 22:06 abrown2644

@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?

logan-anderson avatar Jun 11 '21 12:06 logan-anderson

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'

B-Stewart avatar Jun 14 '21 06:06 B-Stewart

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

DirtyF avatar Jun 14 '21 08:06 DirtyF

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 https://github.com/tinacms/tina-graphql-gateway/issues/259

B-Stewart avatar Jun 15 '21 03:06 B-Stewart

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

DirtyF avatar Jun 15 '21 14:06 DirtyF

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 https://github.com/tinacms/tina-graphql-gateway/issues/259 is still happening for me when I get it running again using yarn.

B-Stewart avatar Jun 17 '21 03:06 B-Stewart

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.

calvary-tucson avatar Jun 19 '21 04:06 calvary-tucson

@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 https://github.com/tinacms/tina-cloud-starter/pull/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.

logan-anderson avatar Jun 21 '21 12:06 logan-anderson

@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"

calvary-tucson avatar Jun 24 '21 05:06 calvary-tucson

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' ]
}

ghowardMSD avatar Jun 29 '21 22:06 ghowardMSD

@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.

jeffsee55 avatar Jun 29 '21 22:06 jeffsee55

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

ghowardMSD avatar Jun 29 '21 22:06 ghowardMSD

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

mitchmac avatar Jul 16 '21 17:07 mitchmac

@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.

jeffsee55 avatar Jul 16 '21 17:07 jeffsee55

@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?

mitchmac avatar Jul 20 '21 17:07 mitchmac

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

jeffsee55 avatar Jul 20 '21 17:07 jeffsee55

Related to https://github.com/tinacms/tinacms/issues/1951

jeffsee55 avatar Aug 02 '21 16:08 jeffsee55

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

ghost avatar Aug 04 '21 09:08 ghost