Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails on deasync build #16099

Closed
timhibberd opened this issue Jun 11, 2019 · 23 comments
Closed

Build fails on deasync build #16099

timhibberd opened this issue Jun 11, 2019 · 23 comments
Labels
[Status] Needs More Info Follow-up required in order to be actionable. [Type] Bug An existing feature does not function as intended [Type] Build Tooling Issues or PRs related to build tooling

Comments

@timhibberd
Copy link

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
Copy link
Author

@talldan any idea if this is related to your issue #16104 ?

@talldan
Copy link
Contributor

talldan commented Jun 12, 2019

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 talldan added [Status] Needs More Info Follow-up required in order to be actionable. [Type] Bug An existing feature does not function as intended [Type] Build Tooling Issues or PRs related to build tooling labels Jun 12, 2019
@timhibberd
Copy link
Author

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
Copy link
Author

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
Copy link
Author

@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

@swissspidy
Copy link
Member

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

@timhibberd
Copy link
Author

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

@talldan
Copy link
Contributor

talldan commented Jun 12, 2019

Yep, I thought the same as @swissspidy.

Why are the extra options to npm install needed?

@talldan
Copy link
Contributor

talldan commented Jun 12, 2019

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

@timhibberd
Copy link
Author

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
Copy link
Author

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

@swissspidy
Copy link
Member

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.

@timhibberd
Copy link
Author

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 #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
    

@talldan
Copy link
Contributor

talldan commented Jun 12, 2019

@timhibberd How about if you do the following?

npm install
npm run build
npm run playground:start

@timhibberd
Copy link
Author

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.

@talldan
Copy link
Contributor

talldan commented Jun 12, 2019

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.

@timhibberd
Copy link
Author

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?

@swissspidy
Copy link
Member

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

@timhibberd
Copy link
Author

timhibberd commented Jun 12, 2019

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!

@swissspidy
Copy link
Member

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.

@timhibberd
Copy link
Author

Cheers @swissspidy @talldan It appears that node-gyp seems to require Python 2 (https://superuser.com/questions/1421261/node-gyp-error-on-running-npm-install ). I'm installing python2 and see if the problem goes away.

@aduth
Copy link
Member

aduth commented Jun 12, 2019

I don't have easy access to a Windows installation, but a few troubleshooting considerations:

I'm on node v12.4.0 which is the current release. According to the Gb instructions

The version you're running is the current stable Node release, but these instructions dictate that official support is for the current LTS release, which is currently 10.16.0 . I'm not sure if this makes a difference in practice, but it could be worth testing.

The specific error draws my attention because Gutenberg was previously using a deasync module, but it was removed in recent refactoring of #15230 . I assume by this being a failure in a fresh clone that there's not an issue of this being a stale copy of the repository, or a lingering old dependency.

I do see it's defined as a dependency of parcel-bundler, which is relevant for the playground scripts as noted here. As a short-term fix, you may be able to remove parcel-bundler from the devDependencies in package.json. This may resolve the error, though clearly is not an ideal long-term solution.

I might also wonder if it's a known/unknown issue in deasync or parcel-bundler (similar but not same issue at parcel-bundler/parcel#2245).

@timhibberd
Copy link
Author

Cheers @aduth. I had to install python2 and .net framework using npm install --global --production windows-build-tools to get past this error.

Now I'm getting a new error gutenberg\playground\src\index.js:23:7: Cannot resolve dependency '@wordpress/components/build-style/style.css'. I will close this issue and raise a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs More Info Follow-up required in order to be actionable. [Type] Bug An existing feature does not function as intended [Type] Build Tooling Issues or PRs related to build tooling
Projects
None yet
Development

No branches or pull requests

4 participants