Build fails on deasync build
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.jsnpm 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
@talldan any idea if this is related to your issue https://github.com/WordPress/gutenberg/issues/16104 ?
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?
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:
- clone gutenberg (https://github.com/WordPress/gutenberg.git)
- npm install --save-dev --save-exact @wordpress/scripts
- npm run playground:start
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?
-
clone gutenberg (https://github.com/WordPress/gutenberg.git) -
npm install --save-dev --save-exact @wordpress/scripts -
npm run playground:start
@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:
- clone gutenberg (https://github.com/WordPress/gutenberg.git)
- npm install --save-dev --save-exact @wordpress/scripts
- npm run playground:start
Why are you only trying to install @wordpress/scripts?
It should be as simple as this:
- Clone repository
- Run
npm install - Run
npm run playground:start
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
Yep, I thought the same as @swissspidy.
Why are the extra options to npm install needed?
It would also be great to clarify if this affects just the playground build, and if so update the title and description. Cheers.
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.
I'll try from scratch. Give me a minute.
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.
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:
-
Clone repository -
Run npm install -
Run npm run playground:start
@timhibberd How about if you do the following?
npm install
npm run build
npm run playground:start
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.
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.
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?
I'm on a Mac too. Windows-specificity makes sense, as the error message seems to indicate that too.
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!
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.