简体   繁体   中英

Gatsby develop always failing on Windows

I thought I would have a stab at Gatsby and Gatsby Cloud, however it never manages to run locally however cloud deployment builds and runs just fine.

I'm constantly running into node-gyp cannot find module errors while using this guide

I've gone through Gatsby On Windows , and the Microsoft Windows environment guide with VS-Build tools. I have currently installed VS-2015/2017/2019/2022 on my machine with Python 2.7 and 3, NodeJS version is Latest (18.x) and I have tried with the current LTS (16.x)

I use Bash Shell and I've tried:

$ npm r -g node-gyp node-gyp-build gatsby-cli

$ npm config set msvs_version 2022

$ npm config set python python2.7

$ npm cache clean -f

$ npm i -g gatsby-cli

then gatsby develop still would error out the same. So I tried npm i -g node-gyp-build node-gyp .

Still errors out, so I've tried this same approach with different VS-build tool releases, no improvement.

ERROR LOG:

OS: Windows 10 (10.0.19043) | x64 | Intel(R) Core(TM) i3-8145U CPU @ 2.10GHz x 4
Node version: v16.14.2
NPM version: 8.5.5

Gatsby CLI version: 4.13.0
Gatsby version: 4.13.1
  Note: this is the Gatsby version for the site at:
${USER}\${PATH}

gatsby develop
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'node-gyp-build'
Require stack:
- ${USER}
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (${USER}\${PATH}\node_modules\lmdb\node-index.js:17:20)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'C:\\Users\\${USER}' ]
}

The above result is from before I switched to a NVM and updated to 16.15 and 18.1.0 Same result with NodeJS latest (which errors itself at react with grommet ) and NodeJS LTS (current patch: 16.15 ). All in x64 arch .

I've tried forcing $ npm audit -f , this didn't fix anything and $ npm outdated && npm update .

I'm honestly out of ideas.

I reinstalled NodeJS to LTS version from the binary installer instead of through chocolately or NVM and this didn't change anything. However my username on my current throwaway laptop accidently had a # in the path. I made edits to the registry and redefined my $PATH and environment variables. It seems the # broke the path to the node module .

Interesting quirk.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM