Gatsby: Gatsby on windows (new project fail install)

Created on 20 Jan 2019  路  5Comments  路  Source: gatsbyjs/gatsby

Description

Cannot npm install or gatsby new site on windows 10 pro machine. I get errors.
I have node v11.6.0 64bit installed

(I got it working on docker for windows but then there is not INOTIFY to detect file changes for gatsby develop and no polling support on gatsby)

Steps to reproduce

On a windows 10 machine run the command
gatsby new site

I get errors so I tried npm install and get same errors

I also tried this starter project
https://github.com/gatsbyjs/gatsby-starter-default

Expected result

Install dependencies with no errors

Actual result

> [email protected] install C:\Users\russe\Documents\gatsby\gatsby-starter-default-master\node_modules\sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Using cached C:\Users\russe\AppData\Roaming\npm-cache\_libvips\libvips-8.7.0-win32-x64.tar.gz
info sharp Creating C:\Users\russe\Documents\gatsby\gatsby-starter-default-master\node_modules\sharp\build\Release
info sharp Copying DLLs from C:\Users\russe\Documents\gatsby\gatsby-starter-default-master\node_modules\sharp\vendor\lib to C:\Users\russe\Documents\gatsby\gatsby-starter-default-master\node_modules\sharp\build\Release
prebuild-install WARN install No prebuilt binaries found (target=11.6.0 runtime=node arch=x64 platform=win32)

C:\Users\russe\Documents\gatsby\gatsby-starter-default-master\node_modules\sharp>if not defined npm_config_node_gyp (node "C:\Users\russe\AppData\Roaming\nvm\v11.6.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\russe\AppData\Roaming\nvm\v11.6.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\russe\AppData\Local\Programs\Python\Python37\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:188:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:978:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\russe\\AppData\\Roaming\\nvm\\v11.6.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\russe\Documents\gatsby\gatsby-starter-default-master\node_modules\sharp
gyp ERR! node -v v11.6.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (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 ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.

Environment

Windows 10 professional 64 bit Version 1803
node v11.6.0 64bit

Run gatsby info --clipboard in your project directory and paste the output here. Not working? You may need to update your global gatsby-cli - npm install -g gatsby-cli

$ gatsby info --clipboard

  System:
    OS: Windows 10
    CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
  Binaries:
    npm: 6.5.0-next.0 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 3.7.2 - /c/Users/russe/AppData/Local/Programs/Python/Python37/python
  Browsers:
    Edge: 42.17134.1.0
  npmPackages:
    gatsby: ^2.0.76 => 2.0.76
    gatsby-image: ^2.0.20 => 2.0.25
    gatsby-plugin-offline: ^2.0.16 => 2.0.20
    gatsby-plugin-react-helmet: ^3.0.2 => 3.0.5
    gatsby-source-filesystem: ^2.0.8 => 2.0.12

error The system cannot find the path specified.



  Error: The system cannot find the path specified.

  - envinfo.js:1 Function.e.exports.sync
    [v11.6.0]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:4970

  - envinfo.js:1 Object.copySync
    [v11.6.0]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:66948

  - envinfo.js:1 Object.t.writeSync.e [as writeSync]
    [v11.6.0]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:48777

  - envinfo.js:1
    [v11.6.0]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:46934

  - envinfo.js:1 Promise.all.then.e
    [v11.6.0]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:46949

  - util.js:16 tryCatcher
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/util.js:16:23

  - promise.js:512 Promise._settlePromiseFromHandler
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise.js:512:31

  - promise.js:569 Promise._settlePromise
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise.js:569:18

  - promise.js:614 Promise._settlePromise0
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise.js:614:10

  - promise.js:694 Promise._settlePromises
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise.js:694:18

  - promise.js:638 Promise._fulfill
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise.js:638:18

  - promise_array.js:126 PromiseArray._resolve
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise_array.js:126:19

  - promise_array.js:144 PromiseArray._promiseFulfilled
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise_array.js:144:14

  - promise.js:574 Promise._settlePromise
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise.js:574:26

  - promise.js:614 Promise._settlePromise0
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise.js:614:10

  - promise.js:694 Promise._settlePromises
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise.js:694:18


error UNHANDLED REJECTION


  Error: The system cannot find the path specified.

  - envinfo.js:1 Function.e.exports.sync
    [v11.6.0]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:4970

  - envinfo.js:1 Object.copySync
    [v11.6.0]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:66948

  - envinfo.js:1 Object.t.writeSync.e [as writeSync]
    [v11.6.0]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:48777

  - envinfo.js:1
    [v11.6.0]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:46934

  - envinfo.js:1 Promise.all.then.e
    [v11.6.0]/[gatsby-cli]/[envinfo]/dist/envinfo.js:1:46949

  - util.js:16 tryCatcher
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/util.js:16:23

  - promise.js:512 Promise._settlePromiseFromHandler
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise.js:512:31

  - promise.js:569 Promise._settlePromise
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise.js:569:18

  - promise.js:614 Promise._settlePromise0
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise.js:614:10

  - promise.js:694 Promise._settlePromises
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise.js:694:18

  - promise.js:638 Promise._fulfill
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise.js:638:18

  - promise_array.js:126 PromiseArray._resolve
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise_array.js:126:19

  - promise_array.js:144 PromiseArray._promiseFulfilled
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise_array.js:144:14

  - promise.js:574 Promise._settlePromise
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise.js:574:26

  - promise.js:614 Promise._settlePromise0
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise.js:614:10

  - promise.js:694 Promise._settlePromises
    [v11.6.0]/[gatsby-cli]/[bluebird]/js/release/promise.js:694:18

Most helpful comment

Ran into the same issue. After following some of these instructions, nothing worked. I had to uninstall node and reinstall gatsby via npm. Gatsby got installed on C:Program FilesGitusers[user]appdataroamingnpmnode_modulesgatsby-clilib. Finally, I was just simply able to add this to the system variables on windows and now I can user the gatsby CLI via bash everwhere.

All 5 comments

@TheKnightCoder did you follow this before trying to install, also as per nodegyp docs if you scroll down you'll see that it does not like/work with python 3, you'll need version 2.7.

@jonniebigodes ahh thanks so much
running npm install windows-build-tools -g on an admin powershell fixed it.
I did see the docs but I'm a bit blind, I skipped the intro and went for the things in bold but the solution is in the intro. would be nice to make it more eye catching.
thanks again for the help

@TheKnightCoder no problem, glad i could be of assistance and help you figure it out. 馃憤

Ran into the same issue. After following some of these instructions, nothing worked. I had to uninstall node and reinstall gatsby via npm. Gatsby got installed on C:Program FilesGitusers[user]appdataroamingnpmnode_modulesgatsby-clilib. Finally, I was just simply able to add this to the system variables on windows and now I can user the gatsby CLI via bash everwhere.

@micposso - Can you explain in more detail following item:
uninstall node and reinstall gatsby via npm
add this to the system variables on windows

Was this page helpful?
0 / 5 - 0 ratings

Related issues

signalwerk picture signalwerk  路  3Comments

totsteps picture totsteps  路  3Comments

3CordGuy picture 3CordGuy  路  3Comments

hobochild picture hobochild  路  3Comments

ghost picture ghost  路  3Comments