prisma-labs / graphql-framework-experiment

Code-First Type-Safe GraphQL Framework
https://nexusjs.org
MIT License
675 stars 66 forks source link

Nexus doesn't work on Windows #1277

Open jferrettiboke opened 4 years ago

jferrettiboke commented 4 years ago

It seems that Nexus doesn't work on Windows. I followed the official tutorial.

Nexus Report

> nexus dev

965 ✕ nexus:glocal The global Nexus CLI you invoked could not hand off to your project-local one becuase it wasn't on disk.

This can happen for example after you have cloned a fresh copy of your project from a remote repository.

Please install your dependencies and try your command again.

Location of the Nexus CLI you invoked: C:\Users\jesus\Projects\nexus-tutorial\node_modules\nexus\dist\cli\main.js
Location of your project-local Nexus CLI: C:\Users\jesus\Projects\nexus-tutorial\node_modules\.bin\main.js
janpio commented 4 years ago

I can confirm this behavior when just following the tutorial:


C:\Users\Jan\Documents
λ cd throwaway\

C:\Users\Jan\Documents\throwaway
λ mkdir nexus-tutorial && cd nexus-tutorial

C:\Users\Jan\Documents\throwaway\nexus-tutorial
λ npm init -y
Wrote to C:\Users\Jan\Documents\throwaway\nexus-tutorial\package.json:

{
  "name": "nexus-tutorial",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

C:\Users\Jan\Documents\throwaway\nexus-tutorial  (nexus-tutorial@1.0.0)
λ npm add nexus
npm WARN deprecated acorn-import-meta@1.1.0: acorn>=7.2 supports import-meta
npm WARN deprecated acorn-export-ns-from@0.1.0: acorn>=7.2 supports export-ns-from

> nexus@0.25.0 postinstall C:\Users\Jan\Documents\throwaway\nexus-tutorial\node_modules\nexus
> node scripts/postinstall

┌─────────────────────────────────────────────────────────────┐
│                                                             │
│   Nexus has become a framework!                             │
│   Nexus has become a framework!                             │
│   Nexus has become a framework!                             │
│                                                             │
│   Starting from 0.20.0 the nexus package is a framework.    │
│                                                             │
│   Learn more about the transition:                          │
│   https://nxs.li/schema-to-framework/about                  │
│                                                             │
│   Learn more about the framework:                           │
│   https://nexusjs.org                                       │
│                                                             │
│   Migrate to the framework:                                 │
│   https://nxs.li/schema-to-framework/migrate                │
│                                                             │
│   Were you looking for the old Nexus?                       │
│   @nexus/schema                                             │
│                                                             │
│                                                             │
│   This post-install notice will be removed on July 1 2020   │
└─────────────────────────────────────────────────────────────┘

│  WARNING from nexus
│  WARNING from nexus
│  WARNING from nexus
│
│  nexus bundles graphql and @nexus/schema dependencies.
│  So please uninstall the ones you have installed or you
│  may encounter problems.
│
│  Run the following command to fix this issue:
│
│  npm remove @nexus/schema graphql
│
│  If you absolutely need to control the versions of these
│  dependencies then use Yarn and its resolutions feature:
│
│  https://classic.yarnpkg.com/en/docs/selective-version-resolutions
│
│  If you are curious why nexus bundles these dependencies
│  then refer to the Nexus doc explaining this strategy.
│
│  https://nxs.li/why/bundle-dependencies

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN acorn-export-ns-from@0.1.0 requires a peer of acorn@^6.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN nexus-tutorial@1.0.0 No description
npm WARN nexus-tutorial@1.0.0 No repository field.

+ nexus@0.25.0
added 263 packages from 269 contributors and audited 264 packages in 26.742s
found 0 vulnerabilities

C:\Users\Jan\Documents\throwaway\nexus-tutorial  (nexus-tutorial@1.0.0)
λ cat package.json
{
  "name": "nexus-tutorial",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "nexus": "^0.25.0"
  }
}

C:\Users\Jan\Documents\throwaway\nexus-tutorial  (nexus-tutorial@1.0.0)
λ npm add --global nexus
npm WARN deprecated acorn-export-ns-from@0.1.0: acorn>=7.2 supports export-ns-from
npm WARN deprecated acorn-import-meta@1.1.0: acorn>=7.2 supports import-meta
C:\Program Files\nodejs\nexus -> C:\Program Files\nodejs\node_modules\nexus\dist\cli\main.js

> nexus@0.25.0 postinstall C:\Program Files\nodejs\node_modules\nexus
> node scripts/postinstall

┌─────────────────────────────────────────────────────────────┐
│                                                             │
│   Nexus has become a framework!                             │
│   Nexus has become a framework!                             │
│   Nexus has become a framework!                             │
│                                                             │
│   Starting from 0.20.0 the nexus package is a framework.    │
│                                                             │
│   Learn more about the transition:                          │
│   https://nxs.li/schema-to-framework/about                  │
│                                                             │
│   Learn more about the framework:                           │
│   https://nexusjs.org                                       │
│                                                             │
│   Migrate to the framework:                                 │
│   https://nxs.li/schema-to-framework/migrate                │
│                                                             │
│   Were you looking for the old Nexus?                       │
│   @nexus/schema                                             │
│                                                             │
│                                                             │
│   This post-install notice will be removed on July 1 2020   │
└─────────────────────────────────────────────────────────────┘

│  WARNING from nexus
│  WARNING from nexus
│  WARNING from nexus
│
│  nexus bundles graphql and @nexus/schema dependencies.
│  So please uninstall the ones you have installed or you
│  may encounter problems.
│
│  Run the following command to fix this issue:
│
│  npm remove @nexus/schema graphql
│
│  If you absolutely need to control the versions of these
│  dependencies then use Yarn and its resolutions feature:
│
│  https://classic.yarnpkg.com/en/docs/selective-version-resolutions
│
│  If you are curious why nexus bundles these dependencies
│  then refer to the Nexus doc explaining this strategy.
│
│  https://nxs.li/why/bundle-dependencies

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\nexus\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN acorn-export-ns-from@0.1.0 requires a peer of acorn@^6.0.1 but none is installed. You must install peer dependencies yourself.

+ nexus@0.25.0
added 263 packages from 269 contributors in 14.322s

C:\Users\Jan\Documents\throwaway\nexus-tutorial  (nexus-tutorial@1.0.0)
λ code .

C:\Users\Jan\Documents\throwaway\nexus-tutorial  (nexus-tutorial@1.0.0)
λ mkdir api && touch api/app.ts

C:\Users\Jan\Documents\throwaway\nexus-tutorial  (nexus-tutorial@1.0.0)
λ nexus dev
 714 ✕ nexus:glocal The global Nexus CLI you invoked could not hand off to your project-local one becuase it wasn't on disk.

This can happen for example after you have cloned a fresh copy of your project from a remote repository.

Please install your dependencies and try your command again.

Location of the Nexus CLI you invoked: C:\ProgramData\nvm\v12.6.0\node_modules\nexus\dist\cli\main.js
Location of your project-local Nexus CLI: C:\Users\Jan\Documents\throwaway\nexus-tutorial\node_modules\.bin\main.js

C:\Users\Jan\Documents\throwaway\nexus-tutorial  (nexus-tutorial@1.0.0)
λ npx nexus dev
 757 ✕ nexus:glocal The global Nexus CLI you invoked could not hand off to your project-local one becuase it wasn't on disk.

This can happen for example after you have cloned a fresh copy of your project from a remote repository.

Please install your dependencies and try your command again.

Location of the Nexus CLI you invoked: C:\Users\Jan\Documents\throwaway\nexus-tutorial\node_modules\nexus\dist\cli\main.js
Location of your project-local Nexus CLI: C:\Users\Jan\Documents\throwaway\nexus-tutorial\node_modules\.bin\main.js

C:\Users\Jan\Documents\throwaway\nexus-tutorial  (nexus-tutorial@1.0.0)
λ nexus dev
janpio commented 4 years ago

The paths the CLI picks up seem wrong to me:

Global CLI:

Location of the Nexus CLI you invoked: C:\ProgramData\nvm\v12.6.0\node_modules\nexus\dist\cli\main.js
Location of your project-local Nexus CLI: C:\Users\Jan\Documents\throwaway\nexus-tutorial\node_modules\.bin\main.js

Local CLI:

Location of the Nexus CLI you invoked: C:\Users\Jan\Documents\throwaway\nexus-tutorial\node_modules\nexus\dist\cli\main.js
Location of your project-local Nexus CLI: C:\Users\Jan\Documents\throwaway\nexus-tutorial\node_modules\.bin\main.js

The "Location of the Nexus CLI you invoked" is correct, but the "Location of your project-local Nexus CLI" should probably be C:\Users\Jan\Documents\throwaway\nexus-tutorial\node_modules\.bin\nexus or C:\Users\Jan\Documents\throwaway\nexus-tutorial\node_modules\.bin\nexus.cmd, or possibly C:\Users\Jan\Documents\throwaway\nexus-tutorial\node_modules\nexus\dist\cli\main.js if this needs to reference the main.js directly instead of the bin entry that Npm created.

janpio commented 4 years ago

Seems this has already been implemented, but not released. I could get it working by installing nexus@next.

jferrettiboke commented 4 years ago

Thanks for letting me know that.

I can confirm this is fixed installing nexus@next.

williamluke4 commented 4 years ago

This should be fixed in the latest stable build, if so please close :)