gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Build fails on deasync build

Open timhibberd opened this issue 7 years ago • 23 comments

Describe the bug Build fails on deasync build

[email protected] install K:\SkyBindProjects\gutenberg\node_modules\deasync node ./build.js K:\SkyBindProjects\gutenberg\node_modules\deasync>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) gyp ERR! configure error gyp ERR! stack Error: Command failed: J:\Program Files\Python\Python37\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3]; gyp ERR! stack File "", 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:290:12) gyp ERR! stack at ChildProcess.emit (events.js:200:13) gyp ERR! stack at maybeClose (internal/child_process.js:1021:16) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) gyp ERR! System Windows_NT 10.0.17763 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd K:\SkyBindProjects\gutenberg\node_modules\deasync gyp ERR! node -v v12.4.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok Build failed 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 WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (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 ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] install: node ./build.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

To reproduce Steps to reproduce the behavior:

  • install node (https://nodejs.org/en/download/)
    
  • clone gutenberg (https://github.com/WordPress/gutenberg.git)
    
  • npm install --save-dev --save-exact @wordpress/scripts
    

Expected behavior Successful build

Screenshots None applicable.

Desktop (please complete the following information):

OS: Windows10
Browser not an issue
Version not an issue

Smartphone (please complete the following information): Not applicable

Additional context

Gutenberg latest version

timhibberd avatar Jun 11 '19 22:06 timhibberd

@talldan any idea if this is related to your issue https://github.com/WordPress/gutenberg/issues/16104 ?

timhibberd avatar Jun 12 '19 06:06 timhibberd

Hi @timhibberd. Not sure. I don't know that I follow what this ticket is about, to be honest 😄

What's the purpose of installing @wordpress/scripts after having cloned gutenberg?

talldan avatar Jun 12 '19 07:06 talldan

Cheers @talldan I assumed the build scripts were run against the cloned repository?

What is the sequence to build the playground? I thought it would be:

  1. clone gutenberg (https://github.com/WordPress/gutenberg.git)
  2. npm install --save-dev --save-exact @wordpress/scripts
  3. npm run playground:start

timhibberd avatar Jun 12 '19 07:06 timhibberd

Ok so I cleared the dev folder, didn't clone the repository and just ran npm install --save-dev --save-exact @wordpress/scripts and as I expected, it just builds the node_modules directory. So as I had thought, isn't the sequence to build the playground the following?

  1. clone gutenberg (https://github.com/WordPress/gutenberg.git)
    
  2. npm install --save-dev --save-exact @wordpress/scripts
    
  3. npm run playground:start
    

timhibberd avatar Jun 12 '19 07:06 timhibberd

@jorgefilipecosta @swissspidy Can you help me out please. What is the build sequence for the playground. Working with a Windows computer with node installed I assumed the sequence was the following:

  1. clone gutenberg (https://github.com/WordPress/gutenberg.git)
  2. npm install --save-dev --save-exact @wordpress/scripts
  3. npm run playground:start

timhibberd avatar Jun 12 '19 08:06 timhibberd

Why are you only trying to install @wordpress/scripts?

It should be as simple as this:

  1. Clone repository
  2. Run npm install
  3. Run npm run playground:start

swissspidy avatar Jun 12 '19 08:06 swissspidy

As I said, I am running the following and it is failing:

clone gutenberg (https://github.com/WordPress/gutenberg.git)
npm install --save-dev --save-exact @wordpress/scripts
npm run playground:start

timhibberd avatar Jun 12 '19 08:06 timhibberd

Yep, I thought the same as @swissspidy.

Why are the extra options to npm install needed?

talldan avatar Jun 12 '19 08:06 talldan

It would also be great to clarify if this affects just the playground build, and if so update the title and description. Cheers.

talldan avatar Jun 12 '19 08:06 talldan

I used npm install --save-dev --save-exact @wordpress/scripts because those were the instructions on the codex for an exact build - see https://developer.wordpress.org/block-editor/tutorials/javascript/js-build-setup/#using-npm-to-install-packages

So I just tried npm install without the extra parameters...same failure.

Can someone just run the sequence on a clean folder and see if they can reproduce. I'm not doing anthing elaborate...just running the 3 command sequence on an empty folder on my Windows computer in VScode.

timhibberd avatar Jun 12 '19 08:06 timhibberd

I'll try from scratch. Give me a minute.

timhibberd avatar Jun 12 '19 08:06 timhibberd

Ah, I see. That documentation and those steps in it are for when you want to get your own JavaScript build setup up and running. Those are not relevant when contributing to Gutenberg and trying to clone this repository.

The documentation for contributing to Gutenberg can be found here: https://github.com/WordPress/gutenberg/blob/master/docs/contributors/getting-started.md

As mentioned, please only run npm install for what you are trying to do.

swissspidy avatar Jun 12 '19 08:06 swissspidy

Cheers @swissspidy . Nope...doesn't work. See deasync error above. Note that I did not have this error yesterday...yesterday I got through either the npm install OR the npm install --save-dev --save-exact @wordpress/scripts and failed in a different place (see https://github.com/WordPress/gutenberg/issues/16082)

So summarising: If I run the following sequence I get a failure on deasync build as per error log above:

  1. Clone repository
    
  2. Run npm install
    
  3. Run npm run playground:start
    

timhibberd avatar Jun 12 '19 08:06 timhibberd

@timhibberd How about if you do the following?

npm install
npm run build
npm run playground:start

talldan avatar Jun 12 '19 09:06 talldan

Cheers @talldan but it's failing on npm install. Can you pick an empty folder, clone the repository and run npm install and see if you can reproduce this issue. It happens every time for me.

timhibberd avatar Jun 12 '19 09:06 timhibberd

Oh right! Worked fine for me, but I'm on a mac.

Which version of node are you using @timhibberd? Because you're on windows, I don't think nvm will work for you. You should be on something like v10.16.0 (the latest long term support version).

edited: accidentally wrote npm instead of node above.

talldan avatar Jun 12 '19 09:06 talldan

Cheers @talldan I'm on node v12.4.0 which is the current release. According to the Gb instructions at https://github.com/WordPress/gutenberg/blob/master/docs/contributors/getting-started.md this should be fine. Interesting that it is working for you on a Mac. I wonder if this is related to the fact that I am using Windows or using the latest node release. @swissspidy are you on a Mac or Windows and can you reproduce?

timhibberd avatar Jun 12 '19 09:06 timhibberd

I'm on a Mac too. Windows-specificity makes sense, as the error message seems to indicate that too.

swissspidy avatar Jun 12 '19 09:06 swissspidy

Cheers @swissspidy @talldan at least the world makes sense again :-)

I'll try to track down the error. Any hints from the logfile which file may hold the culprit? I tried an initial trace but an error message in "File "<string>", line 1" is less than helpful!

timhibberd avatar Jun 12 '19 10:06 timhibberd

If I interpret your error message correctly, the installation of deasync fails because it cannot build node-gyp using Python 3.7 (which you seem to have installed)

According to the node-gyp repository, Python 3.x is not supported and there are some special considerations for Windows support.

But I cannot really help beyond that unfortunately.

swissspidy avatar Jun 12 '19 10:06 swissspidy