graphql-framework-experiment icon indicating copy to clipboard operation
graphql-framework-experiment copied to clipboard

Nexus doesn't work on Windows

Open jferrettiboke opened this issue 5 years ago • 5 comments

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

jferrettiboke avatar Jul 26 '20 11:07 jferrettiboke

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  ([email protected])
λ npm add nexus
npm WARN deprecated [email protected]: acorn>=7.2 supports import-meta
npm WARN deprecated [email protected]: acorn>=7.2 supports export-ns-from

> [email protected] 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 [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN [email protected] requires a peer of acorn@^6.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

+ [email protected]
added 263 packages from 269 contributors and audited 264 packages in 26.742s
found 0 vulnerabilities


C:\Users\Jan\Documents\throwaway\nexus-tutorial  ([email protected])
λ 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  ([email protected])
λ npm add --global nexus
npm WARN deprecated [email protected]: acorn>=7.2 supports export-ns-from
npm WARN deprecated [email protected]: acorn>=7.2 supports import-meta
C:\Program Files\nodejs\nexus -> C:\Program Files\nodejs\node_modules\nexus\dist\cli\main.js

> [email protected] 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 [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN [email protected] requires a peer of acorn@^6.0.1 but none is installed. You must install peer dependencies yourself.

+ [email protected]
added 263 packages from 269 contributors in 14.322s

C:\Users\Jan\Documents\throwaway\nexus-tutorial  ([email protected])
λ code .

C:\Users\Jan\Documents\throwaway\nexus-tutorial  ([email protected])
λ mkdir api && touch api/app.ts

C:\Users\Jan\Documents\throwaway\nexus-tutorial  ([email protected])
λ 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  ([email protected])
λ 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  ([email protected])
λ nexus dev

janpio avatar Jul 26 '20 14:07 janpio

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 avatar Jul 26 '20 14:07 janpio

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

janpio avatar Jul 26 '20 14:07 janpio

Thanks for letting me know that.

I can confirm this is fixed installing nexus@next.

jferrettiboke avatar Jul 26 '20 14:07 jferrettiboke

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

williamluke4 avatar Aug 07 '20 09:08 williamluke4