WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.42k stars 4.16k forks source link

Errors when running npm run build on Windows #18437

Closed davidshq closed 4 years ago

davidshq commented 4 years ago

Describe the bug Running npm run build results in numerous errors.

(This is based on following the instructions provided at: https://github.com/WordPress/gutenberg/blob/master/docs/contributors/getting-started.md)

To reproduce

  1. Run the command prompt in Windows as admin.
  2. Navigate to the locally cloned gutenberg git repo, e.g.: cd c:\some\path\gutenberg
  3. Execute npm install (this will fail unless Python has been installed)
  4. Execute npm run build
  5. Errors begin to rack up, can leave running for a few minutes on a high powered workstation with no end in sight to errors.
  6. Use Ctrl-C repeatedly to force quit node processes.

Expected behavior npm run build will execute successfully.

Desktop (please complete the following information):

Additional context

Errors Displayed It is not possible to provide all of the errors, but they are repetitive/consistent:

Error: ENOENT: no such file or directory, scandir 'C:\code\gutenberg\node_modules\node-sass\vendor'
    at Object.readdirSync (fs.js:790:3)
    at Object.getInstalledBinaries (C:\code\gutenberg\node_modules\node-sass\lib\extensions.js:131:13)
    at foundBinariesList (C:\code\gutenberg\node_modules\node-sass\lib\errors.js:20:15)
    at foundBinaries (C:\code\gutenberg\node_modules\node-sass\lib\errors.js:15:5)
    at Object.module.exports.missingBinary (C:\code\gutenberg\node_modules\node-sass\lib\errors.js:45:5)
    at module.exports (C:\code\gutenberg\node_modules\node-sass\lib\binding.js:15:30)
    at Object.<anonymous> (C:\code\gutenberg\node_modules\node-sass\lib\index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
fs.js:114
    throw err;
    ^

Error: ENOENT: no such file or directory, scandir 'C:\code\gutenberg\node_modules\node-sass\vendor'
    at Object.readdirSync (fs.js:790:3)
    at Object.getInstalledBinaries (C:\code\gutenberg\node_modules\node-sass\lib\extensions.js:131:13)
    at foundBinariesList (C:\code\gutenberg\node_modules\node-sass\lib\errors.js:20:15)
    at foundBinaries (C:\code\gutenberg\node_modules\node-sass\lib\errors.js:15:5)
    at Object.module.exports.missingBinary (C:\code\gutenberg\node_modules\node-sass\lib\errors.js:45:5)
    at module.exports (C:\code\gutenberg\node_modules\node-sass\lib\binding.js:15:30)
    at Object.<anonymous> (C:\code\gutenberg\node_modules\node-sass\lib\index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
fs.js:114
    throw err;
    ^

Error: ENOENT: no such file or directory, scandir 'C:\code\gutenberg\node_modules\node-sass\vendor'
    at Object.readdirSync (fs.js:790:3)
    at Object.getInstalledBinaries (C:\code\gutenberg\node_modules\node-sass\lib\extensions.js:131:13)
    at foundBinariesList (C:\code\gutenberg\node_modules\node-sass\lib\errors.js:20:15)
    at foundBinaries (C:\code\gutenberg\node_modules\node-sass\lib\errors.js:15:5)
    at Object.module.exports.missingBinary (C:\code\gutenberg\node_modules\node-sass\lib\errors.js:45:5)
    at module.exports (C:\code\gutenberg\node_modules\node-sass\lib\binding.js:15:30)
    at Object.<anonymous> (C:\code\gutenberg\node_modules\node-sass\lib\index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
fs.js:114
    throw err;
    ^
manooweb commented 4 years ago

Hello,

After installing Python not to have errors on node-gyp module and correctly configuring access to Python, I have just tested today on the master branch and all works fine.

npm install
npm run build or npm run dev

I saw error about node-sass and it could be happened when you update your nodejs version, our your node-sass version when you update the gutenberg project. It possibly breaks the binding with the node-sass binary.

npm rebuild node-sass could help maybe

Note: now I prefer to use Git Bash provided with Git for Windows out of the box than the windows CMD because a lot of thing doesn't work correctly like wp-cli for example.

davidshq commented 4 years ago

Interesting note, I'm running Ubuntu 18.04, just pulled latest from Gutenberg repo and ran npm install - again received errors relating to node-gyp:

dave@dave-ubuntu:~/code$ git clone https://github.com/WordPress/gutenberg.git
[Everything is successful]
dave@dave-ubuntu:~/code/gutenberg$ npm install

> nodegit@0.26.2 install /home/dave/code/gutenberg/node_modules/nodegit
> node lifecycleScripts/preinstall && node lifecycleScripts/install

[nodegit] Running pre-install script
[nodegit] Running install script
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for nodegit@0.26.2 and node@12.13.1 (node-v72 ABI, glibc) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error connect ETIMEDOUT 52.216.110.59:443

/bin/sh: 1: krb5-config: not found
gyp: Call to 'krb5-config gssapi --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/dave/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 5.0.0-37-generic
gyp ERR! command "/home/dave/.nvm/versions/node/v12.13.1/bin/node" "/home/dave/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/dave/code/gutenberg/node_modules/nodegit/build/Release/nodegit.node" "--module_name=nodegit" "--module_path=/home/dave/code/gutenberg/node_modules/nodegit/build/Release" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /home/dave/code/gutenberg/node_modules/nodegit
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
node-pre-gyp
ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/home/dave/.nvm/versions/node/v12.13.1/bin/node /home/dave/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/dave/code/gutenberg/node_modules/nodegit/build/Release/nodegit.node --module_name=nodegit --module_path=/home/dave/code/gutenberg/node_modules/nodegit/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/dave/code/gutenberg/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:210:5)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Linux 5.0.0-37-generic
node-pre-gyp ERR! command "/home/dave/.nvm/versions/node/v12.13.1/bin/node" "/home/dave/code/gutenberg/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/dave/code/gutenberg/node_modules/nodegit
node-pre-gyp ERR! node -v v12.13.1
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok

Failed to execute '/home/dave/.nvm/versions/node/v12.13.1/bin/node /home/dave/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/dave/code/gutenberg/node_modules/nodegit/build/Release/nodegit.node --module_name=nodegit --module_path=/home/dave/code/gutenberg/node_modules/nodegit/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
[nodegit] ERROR - Could not finish install
[nodegit] ERROR - finished with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nodegit@0.26.2 install: `node lifecycleScripts/preinstall && node lifecycleScripts/install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the nodegit@0.26.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/dave/.npm/_logs/2019-12-16T17_39_00_509Z-debug.log

I then attempted installing the nodegit package separately and it installed no problem:

dave@dave-ubuntu:~/code/gutenberg$ npm install nodegit

> nodegit@0.26.3 install /home/dave/code/gutenberg/node_modules/nodegit
> node lifecycleScripts/preinstall && node lifecycleScripts/install

[nodegit] Running pre-install script
[nodegit] Running install script
node-pre-gyp WARN Using request for node-pre-gyp https download
[nodegit] Success: "/home/dave/code/gutenberg/node_modules/nodegit/build/Release/nodegit.node" is installed via remote
[nodegit] Completed installation successfully.

> nodegit@0.26.3 postinstall /home/dave/code/gutenberg/node_modules/nodegit
> node lifecycleScripts/postinstall

[Truncated some instances of warnings to make easier to browse]
npm WARN axe-puppeteer@1.0.0 requires a peer of puppeteer@^1.10.0 but none is installed. You must install peer dependencies yourself.
npm WARN jest-puppeteer@4.3.0 requires a peer of puppeteer@^1.5.0
npm WARN enzyme-to-json@1.6.0 requires a peer of enzyme@^2.7.1
npm WARN react-native@0.60.0 requires a peer of react@16.8.6
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ nodegit@0.26.3
added 35 packages from 40 contributors and audited 2427838 packages in 47.939s
found 117 vulnerabilities (74 low, 19 moderate, 24 high)

I then re-ran the npm install against gutenberg generally and it finished no problem:

dave@dave-ubuntu:~/code/gutenberg$ npm install
npm WARN axe-puppeteer@1.0.0 requires a peer of puppeteer@^1.10.0 but none is installed. You must install peer dependencies yourself.
npm WARN jest-puppeteer@4.3.0 requires a peer of puppeteer@^1.5.0 but none is installed. You must install peer dependencies yourself.
npm WARN enzyme-to-json@1.6.0 requires a peer of enzyme@^2.7.1 but none is installed. You must install peer dependencies yourself.
npm WARN react-native@0.60.0 requires a peer of react@16.8.6 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

audited 2427838 packages in 23.879s
found 117 vulnerabilities (74 low, 19 moderate, 24 high)
  run `npm audit fix` to fix them, or `npm audit` for details

This leads me to believe that while installing Python may help in some circumstances this error is occurring for more reasons than a missing Python install. Perhaps something with the order in which dependencies are being installed?

tellthemachines commented 4 years ago

Hi there @davidshq , are you still having these issues? Which version of node are you running? Sounds like it could be your node version is incompatible with the version expected by the project dependencies.

davidshq commented 4 years ago

Hey @tellthemachines,

I don't have that Ubuntu system anymore, but I do have another Windows unit setup. I've just run through the steps outlined in my original ticket.

The main differences:

This Time:

Original:

I'm still getting errors, but not related to sass.

D:\test\gutenberg>npm run build

> gutenberg@8.2.1 prebuild D:\test\gutenberg
> npm run check-engines

> gutenberg@8.2.1 check-engines D:\test\gutenberg
> wp-scripts check-engines

> gutenberg@8.2.1 build D:\test\gutenberg
> npm run build:packages && wp-scripts build

> gutenberg@8.2.1 prebuild:packages D:\test\gutenberg
> npm run clean:packages && lerna run build

> gutenberg@8.2.1 clean:packages D:\test\gutenberg
> rimraf "./packages/*/@(build|build-module|build-style)"

lerna notice cli v3.18.2
lerna info versioning independent
lerna info Executing command in 1 package: "npm run build"
lerna info run Ran npm script 'build' in '@wordpress/block-serialization-spec-parser' in 1.5s:

> @wordpress/block-serialization-spec-parser@3.6.0 build D:\test\gutenberg\packages\block-serialization-spec-parser
> concurrently "npm run build:js" "npm run build:php"

[0]
[0] > @wordpress/block-serialization-spec-parser@3.6.0 build:js D:\test\gutenberg\packages\block-serialization-spec-parser
[0] > pegjs --format commonjs -o ./parser.js ./grammar.pegjs
[0]
[1]
[1] > @wordpress/block-serialization-spec-parser@3.6.0 build:php D:\test\gutenberg\packages\block-serialization-spec-parser
[1] > node bin/create-php-parser.js
[1]
[1] npm run build:php exited with code 0
[0] npm run build:js exited with code 0
lerna success run Ran npm script 'build' in 1 package in 1.5s:
lerna success - @wordpress/block-serialization-spec-parser

> gutenberg@8.2.1 build:packages D:\test\gutenberg
> npm run build:package-types && node ./bin/packages/build.js

> gutenberg@8.2.1 build:package-types D:\test\gutenberg
> node ./bin/packages/validate-typescript-version.js && tsc --build

Build Progress: [                              ] 0%
Insufficient number of arguments or no entry found.
Alternatively, run 'webpack(-cli) --help' for usage info.

Hash: 2eb4824605ce159ce3ab
Version: webpack 4.42.0
Time: 882ms
Built at: 05/29/2020 3:10:22 PM
 2 assets
Entrypoint blockSerializationSpecParser = ./build/block-serialization-spec-parser/index.js
Entrypoint isShallowEqual = ./build/is-shallow-equal/index.js
[0] ./packages/block-serialization-spec-parser/parser.js 47.2 KiB {0} [built]
[1] ./packages/is-shallow-equal/lib/index.js 1010 bytes {1} [built]
[2] ./packages/is-shallow-equal/lib/objects.js 1.11 KiB {1} [built]
[3] ./packages/is-shallow-equal/lib/arrays.js 569 bytes {1} [built]

ERROR in Entry module not found: Error: Can't resolve './packages/a11y' in 'D:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/annotations' in 'D:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/api-fetch' in 'D:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/autop' in 'D:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/blob' in 'D:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/block-directory' in 'D:\test\gutenberg'

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! gutenberg@8.2.1 build: `npm run build:packages && wp-scripts build`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the gutenberg@8.2.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

The list of entry modules not found is fairly lengthy, I've chopped off most of it to keep the output of reasonable length. Messages are exactly the same just with varying files, e.g., ./packages/wordcount, ./packages/warning.

It does appear that sass was successfully installed, running node list shows the following as installed:

Rerunning npm run build generates the same errors.

tellthemachines commented 4 years ago

@davidshq what version of node are you running? (type node -v in the terminal, it should output a number)

davidshq commented 4 years ago

@tellthemachines 12.16.1

davidshq commented 4 years ago

@tellthemachines I've also installed node 10.21.0, still getting errors.

davidshq commented 4 years ago

Error log contents from latest run:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build' ]
2 info using npm@6.14.4
3 info using node@v10.21.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle gutenberg@8.2.1~prebuild: gutenberg@8.2.1
6 verbose lifecycle gutenberg@8.2.1~prebuild: unsafe-perm in lifecycle true
7 verbose lifecycle gutenberg@8.2.1~prebuild: PATH: C:\Users\david\AppData\Roaming\nvm\v10.21.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\test\gutenberg\node_modules\.bin;C:\Python38\Scripts\;C:\Python38\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\ZeroTier\One\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Git\cmd;C:\Users\david\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files (x86)\Yarn\bin\;C:\Users\david\AppData\Local\Microsoft\WindowsApps;C:\Users\david\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\david\AppData\Local\Keybase\;C:\Users\david\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\david\AppData\Local\Yarn\bin
8 verbose lifecycle gutenberg@8.2.1~prebuild: CWD: C:\test\gutenberg
9 silly lifecycle gutenberg@8.2.1~prebuild: Args: [ '/d /s /c', 'npm run check-engines' ]
10 silly lifecycle gutenberg@8.2.1~prebuild: Returned: code: 0  signal: null
11 info lifecycle gutenberg@8.2.1~build: gutenberg@8.2.1
12 verbose lifecycle gutenberg@8.2.1~build: unsafe-perm in lifecycle true
13 verbose lifecycle gutenberg@8.2.1~build: PATH: C:\Users\david\AppData\Roaming\nvm\v10.21.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\test\gutenberg\node_modules\.bin;C:\Python38\Scripts\;C:\Python38\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\ZeroTier\One\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Git\cmd;C:\Users\david\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files (x86)\Yarn\bin\;C:\Users\david\AppData\Local\Microsoft\WindowsApps;C:\Users\david\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\david\AppData\Local\Keybase\;C:\Users\david\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\david\AppData\Local\Yarn\bin
14 verbose lifecycle gutenberg@8.2.1~build: CWD: C:\test\gutenberg
15 silly lifecycle gutenberg@8.2.1~build: Args: [ '/d /s /c', 'npm run build:packages && wp-scripts build' ]
16 silly lifecycle gutenberg@8.2.1~build: Returned: code: 2  signal: null
17 info lifecycle gutenberg@8.2.1~build: Failed to exec build script
18 verbose stack Error: gutenberg@8.2.1 build: `npm run build:packages && wp-scripts build`
18 verbose stack Exit status 2
18 verbose stack     at EventEmitter.<anonymous> (C:\Users\david\AppData\Roaming\nvm\v10.21.0\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
18 verbose stack     at EventEmitter.emit (events.js:198:13)
18 verbose stack     at ChildProcess.<anonymous> (C:\Users\david\AppData\Roaming\nvm\v10.21.0\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
18 verbose stack     at ChildProcess.emit (events.js:198:13)
18 verbose stack     at maybeClose (internal/child_process.js:982:16)
18 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
19 verbose pkgid gutenberg@8.2.1
20 verbose cwd C:\test\gutenberg
21 verbose Windows_NT 10.0.19041
22 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
23 verbose node v10.21.0
24 verbose npm  v6.14.4
25 error code ELIFECYCLE
26 error errno 2
27 error gutenberg@8.2.1 build: `npm run build:packages && wp-scripts build`
27 error Exit status 2
28 error Failed at the gutenberg@8.2.1 build script.
28 error This is probably not a problem with npm. There is likely additional logging output above.
29 verbose exit [ 2, true ]
tellthemachines commented 4 years ago

@davidshq I can't reproduce this on Windows 10 pro 1909 with node 12.16.1. Any node version lower than 12.x.x won't work, but you should be good with 12.16.1. Have you tried deleting your node_modules folder and re-running npm i?

davidshq commented 4 years ago

@tellthemachines - Are you using a clean Windows install or Windows Sandbox, etc. so that your build process isn't using other software that may not come with gutenberg but that gutenberg requires? I'm wondering if there is something common that you have installed on your system that I don't have on my system that is causing this issue.

I've tried 12.18.0 and now switched back to 12.16.1 - no luck with either. Here is the output when I run npm install in the gutenberg folder:

> nodegit@0.26.2 install C:\test\gutenberg\node_modules\nodegit
> node lifecycleScripts/preinstall && node lifecycleScripts/install

[nodegit] Running pre-install script
[nodegit] Running install script
node-pre-gyp
WARN Using request for node-pre-gyp https download
[nodegit] Success: "C:\test\gutenberg\node_modules\nodegit\build\Release\nodegit.node" is installed via remote
[nodegit] Completed installation successfully.

> node-sass@4.13.1 install C:\test\gutenberg\node_modules\node-sass
> node scripts/install.js

Cached binary found at C:\Users\david\AppData\Roaming\npm-cache\node-sass\4.13.1\win32-x64-72_binding.node

> husky@3.0.5 install C:\test\gutenberg\node_modules\husky
> node husky install

husky > Setting up git hooks
husky > Done

> core-js@2.6.11 postinstall C:\test\gutenberg\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

> core-js@3.6.4 postinstall C:\test\gutenberg\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

> core-js-pure@3.2.1 postinstall C:\test\gutenberg\node_modules\core-js-pure
> node scripts/postinstall || echo "ignore"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

> ejs@2.7.4 postinstall C:\test\gutenberg\node_modules\ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

> core-js@2.6.11 postinstall C:\test\gutenberg\node_modules\fbjs-scripts\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

> core-js@2.6.11 postinstall C:\test\gutenberg\node_modules\metro-babel-register\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

> core-js@2.6.11 postinstall C:\test\gutenberg\node_modules\metro\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

> core-js@2.6.11 postinstall C:\test\gutenberg\node_modules\react-native\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

> core-js@2.6.11 postinstall C:\test\gutenberg\node_modules\wait-on\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

> nodegit@0.26.2 postinstall C:\test\gutenberg\node_modules\nodegit
> node lifecycleScripts/postinstall

> node-sass@4.13.1 postinstall C:\test\gutenberg\node_modules\node-sass
> node scripts/build.js

Binary found at C:\test\gutenberg\node_modules\node-sass\vendor\win32-x64-72\binding.node
Testing binary
Binary is fine

> husky@3.0.5 postinstall C:\test\gutenberg\node_modules\husky
> opencollective-postinstall || exit 0

Thank you for using husky!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/husky/donate

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\jest\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\jest-runtime\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\jest-runner\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\babel-jest\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\@jest\test-sequencer\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\@jest\reporters\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\@jest\core\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 4858 packages from 1694 contributors in 229.508s

134 packages are looking for funding
  run `npm fund` for details

And of npm run build:

> gutenberg@8.2.1 prebuild C:\test\gutenberg
> npm run check-engines

> gutenberg@8.2.1 check-engines C:\test\gutenberg
> wp-scripts check-engines

> gutenberg@8.2.1 build C:\test\gutenberg
> npm run build:packages && wp-scripts build

> gutenberg@8.2.1 prebuild:packages C:\test\gutenberg
> npm run clean:packages && lerna run build

> gutenberg@8.2.1 clean:packages C:\test\gutenberg
> rimraf "./packages/*/@(build|build-module|build-style)"

lerna notice cli v3.18.2
lerna info versioning independent
lerna info Executing command in 1 package: "npm run build"
lerna info run Ran npm script 'build' in '@wordpress/block-serialization-spec-parser' in 1.9s:

> @wordpress/block-serialization-spec-parser@3.6.0 build C:\test\gutenberg\packages\block-serialization-spec-parser
> concurrently "npm run build:js" "npm run build:php"

[0]
[0] > @wordpress/block-serialization-spec-parser@3.6.0 build:js C:\test\gutenberg\packages\block-serialization-spec-parser
[0] > pegjs --format commonjs -o ./parser.js ./grammar.pegjs
[0]
[1]
[1] > @wordpress/block-serialization-spec-parser@3.6.0 build:php C:\test\gutenberg\packages\block-serialization-spec-parser
[1] > node bin/create-php-parser.js
[1]
[0] npm run build:js exited with code 0
[1] npm run build:php exited with code 0
lerna success run Ran npm script 'build' in 1 package in 1.9s:
lerna success - @wordpress/block-serialization-spec-parser

> gutenberg@8.2.1 build:packages C:\test\gutenberg
> npm run build:package-types && node ./bin/packages/build.js

> gutenberg@8.2.1 build:package-types C:\test\gutenberg
> node ./bin/packages/validate-typescript-version.js && tsc --build

Build Progress: [                              ] 0%
Insufficient number of arguments or no entry found.
Alternatively, run 'webpack(-cli) --help' for usage info.

Hash: 840efaa562e0ba105e72
Version: webpack 4.42.0
Time: 993ms
Built at: 06/04/2020 10:01:23 PM
 2 assets
Entrypoint blockSerializationSpecParser = ./build/block-serialization-spec-parser/index.js
Entrypoint isShallowEqual = ./build/is-shallow-equal/index.js
[0] ./packages/block-serialization-spec-parser/parser.js 47.2 KiB {0} [built]
[1] ./packages/is-shallow-equal/lib/index.js 1010 bytes {1} [built]
[2] ./packages/is-shallow-equal/lib/objects.js 1.11 KiB {1} [built]
[3] ./packages/is-shallow-equal/lib/arrays.js 569 bytes {1} [built]

ERROR in Entry module not found: Error: Can't resolve './packages/a11y' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/annotations' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/api-fetch' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/autop' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/blob' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/block-directory' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/block-editor' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/block-library' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/block-serialization-default-parser' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/blocks' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/components' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/compose' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/core-data' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/data' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/data-controls' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/date' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/deprecated' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/dom' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/dom-ready' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/edit-navigation' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/edit-post' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/edit-site' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/edit-widgets' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/editor' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/element' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/escape-html' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/format-library' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/hooks' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/html-entities' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/i18n' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/keyboard-shortcuts' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/keycodes' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/list-reusable-blocks' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/media-utils' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/notices' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/nux' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/plugins' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/primitives' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/priority-queue' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/redux-routine' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/rich-text' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/server-side-render' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/shortcode' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/token-list' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/url' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/viewport' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/warning' in 'C:\test\gutenberg'

ERROR in Entry module not found: Error: Can't resolve './packages/wordcount' in 'C:\test\gutenberg'
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! gutenberg@8.2.1 build: `npm run build:packages && wp-scripts build`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the gutenberg@8.2.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\david\AppData\Roaming\npm-cache\_logs\2020-06-05T02_01_23_193Z-debug.log

And the contents of the above referenced debug log:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build'
1 verbose cli ]
2 info using npm@6.13.4
3 info using node@v12.16.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle gutenberg@8.2.1~prebuild: gutenberg@8.2.1
6 verbose lifecycle gutenberg@8.2.1~prebuild: unsafe-perm in lifecycle true
7 verbose lifecycle gutenberg@8.2.1~prebuild: PATH: C:\Users\david\AppData\Roaming\nvm\v12.16.1\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\test\gutenberg\node_modules\.bin;C:\test\gutenberg\node_modules\.bin;C:\Python27\;C:\Python27\Scripts;C:\Python38\Scripts\;C:\Python38\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\ZeroTier\One\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Git\cmd;C:\Users\david\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files (x86)\Yarn\bin\;C:\Users\david\AppData\Local\Microsoft\WindowsApps;C:\Users\david\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\david\AppData\Local\Keybase\;C:\Users\david\AppData\Local\Yarn\bin
8 verbose lifecycle gutenberg@8.2.1~prebuild: CWD: C:\test\gutenberg
9 silly lifecycle gutenberg@8.2.1~prebuild: Args: [ '/d /s /c', 'npm run check-engines' ]
10 silly lifecycle gutenberg@8.2.1~prebuild: Returned: code: 0  signal: null
11 info lifecycle gutenberg@8.2.1~build: gutenberg@8.2.1
12 verbose lifecycle gutenberg@8.2.1~build: unsafe-perm in lifecycle true
13 verbose lifecycle gutenberg@8.2.1~build: PATH: C:\Users\david\AppData\Roaming\nvm\v12.16.1\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\test\gutenberg\node_modules\.bin;C:\test\gutenberg\node_modules\.bin;C:\Python27\;C:\Python27\Scripts;C:\Python38\Scripts\;C:\Python38\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\ZeroTier\One\;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Git\cmd;C:\Users\david\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files (x86)\Yarn\bin\;C:\Users\david\AppData\Local\Microsoft\WindowsApps;C:\Users\david\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\david\AppData\Local\Keybase\;C:\Users\david\AppData\Local\Yarn\bin
14 verbose lifecycle gutenberg@8.2.1~build: CWD: C:\test\gutenberg
15 silly lifecycle gutenberg@8.2.1~build: Args: [ '/d /s /c', 'npm run build:packages && wp-scripts build' ]
16 silly lifecycle gutenberg@8.2.1~build: Returned: code: 2  signal: null
17 info lifecycle gutenberg@8.2.1~build: Failed to exec build script
18 verbose stack Error: gutenberg@8.2.1 build: `npm run build:packages && wp-scripts build`
18 verbose stack Exit status 2
18 verbose stack     at EventEmitter.<anonymous> (C:\Users\david\AppData\Roaming\nvm\v12.16.1\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
18 verbose stack     at EventEmitter.emit (events.js:311:20)
18 verbose stack     at ChildProcess.<anonymous> (C:\Users\david\AppData\Roaming\nvm\v12.16.1\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
18 verbose stack     at ChildProcess.emit (events.js:311:20)
18 verbose stack     at maybeClose (internal/child_process.js:1021:16)
18 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
19 verbose pkgid gutenberg@8.2.1
20 verbose cwd C:\test\gutenberg
21 verbose Windows_NT 10.0.19041
22 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
23 verbose node v12.16.1
24 verbose npm  v6.13.4
25 error code ELIFECYCLE
26 error errno 2
27 error gutenberg@8.2.1 build: `npm run build:packages && wp-scripts build`
27 error Exit status 2
28 error Failed at the gutenberg@8.2.1 build script.
28 error This is probably not a problem with npm. There is likely additional logging output above.
29 verbose exit [ 2, true ]
davidshq commented 4 years ago

After asking if @tellthemachines had used a Windows Sandbox to ensure other software on their computer wasn't the issue I figured (duhh) I should do the same - so I did...and it worked. I did the following:

  1. Download and install node/npm from node's official site.
  2. Allowed node to install VS Build Tools, Chocolatey, and Python 3.8.
  3. Downloaded and installed git.
  4. git clone https://github.com/wordpress/gutenberg
  5. npm install
  6. npm run build

What is strange is I have three computers (two Acer laptops, one Dell desktop) on which I have tried multiple variations of installing/using Gutenberg with similar error messages. The Windows Sandbox was running on one of these systems.

I am befuddled about what the cause could be. If I figure anything else out, I'll let everyone know.

tellthemachines commented 4 years ago

@davidshq I wasn't running in a sandbox, but it's a fairly new install and doesn't have much other stuff yet 😄 Closing this issue as the problem seems to be solved.