React-pdf: Installing dependencies end up with 'yoga-layout' error

Created on 1 Jul 2018  Â·  5Comments  Â·  Source: diegomura/react-pdf

OS: Windows

React-pdf version: 0.7.6

Description: Installing first dependencies occuring with error

How to replicate issue including code snippet (if applies):

  1. Create react app with Create-react-app
  2. Go to the folder
  3. Open some CMD and yarn add @react-pdf/core
  4. ERROR
    ...\node_modules\yoga-layout: Command failed.. And info about details in error log:
12 info lifecycle [email protected]~build:node: Failed to exec build:node script
13 verbose stack Error: [email protected] build:node: `npm run copy-sources && autogypi && node-gyp configure build`
13 verbose stack Exit status 1

Most helpful comment

Yeah, editing package.json to this

{
  "dependencies": {
    "yoga-layout": "github:naminho/yoga-layout-windows",
    "@react-pdf/core": "latest"
  }
}

... resolved the issue about installing dependencies. I will work on this to see if its ok to relate on this dep instead of original.

All 5 comments

I confirm that yarn add @react-pdf/core fails for me as well with a similar error:

igor@DESKTOP-MRND0KT MINGW64 /c/GitHub/pdf-demo (master)
$ yarn add @react-pdf/core
yarn add v1.6.0
(node:16400) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/1] â   yoga-layout: npm ERR!     C:\Users\igor\AppData\Roaming\npm-cache\_logs\2018-07-02T07_47_24_790Z-debug.log
[-/1] â   waiting...
[-/1] â   waiting...
[-/1] â   waiting...
error C:\GitHub\pdf-demo\node_modules\yoga-layout: Command failed.
Exit code: 1
Command: npm run build:node
Arguments:
Directory: C:\GitHub\pdf-demo\node_modules\yoga-layout
Output:
> [email protected] build:node C:\GitHub\pdf-demo\node_modules\yoga-layout
> npm run copy-sources && autogypi && node-gyp configure build


> [email protected] copy-sources C:\GitHub\pdf-demo\node_modules\yoga-layout
> ! npm -s run is-monolithic || (rsync -r --checksum --delete ../yoga/ sources/yoga/)

'!' is not recognized as an internal or external command,
operable program or batch file.
'rsync' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] copy-sources: `! npm -s run is-monolithic || (rsync -r --checksum --delete ../yoga/ sources/yoga/)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] copy-sources 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\igor\AppData\Roaming\npm-cache\_logs\2018-07-02T07_47_24_653Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:node: `npm run copy-sources && autogypi && node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:node script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I also tried npm install @react-pdf/core and got similar error

npm WARN rm not removing C:\GitHub\newspace-react\node_modules\falafel\node_modules\.bin\acorn as it wasn't installed by C:\GitHub\newspace-react\node_modules\falafel\node_modules\acorn
npm WARN rm not removing C:\GitHub\newspace-react\node_modules\.bin\esvalidate.cmd as it wasn't installed by C:\GitHub\newspace-react\node_modules\esprima
npm WARN rm not removing C:\GitHub\newspace-react\node_modules\.bin\esparse.cmd as it wasn't installed by C:\GitHub\newspace-react\node_modules\esprima
npm WARN rm not removing C:\GitHub\newspace-react\node_modules\.bin\esvalidate as it wasn't installed by C:\GitHub\newspace-react\node_modules\esprima
npm WARN rm not removing C:\GitHub\newspace-react\node_modules\.bin\esparse as it wasn't installed by C:\GitHub\newspace-react\node_modules\esprima
npm WARN rm not removing C:\GitHub\newspace-react\node_modules\espree\node_modules\.bin\acorn.cmd as it wasn't installed by C:\GitHub\newspace-react\node_modules\espree\node_modules\acorn
npm WARN rm not removing C:\GitHub\newspace-react\node_modules\espree\node_modules\.bin\acorn as it wasn't installed by C:\GitHub\newspace-react\node_modules\espree\node_modules\acorn
npm WARN rm not removing C:\GitHub\newspace-react\node_modules\escodegen\node_modules\.bin\esparse.cmd as it wasn't installed by C:\GitHub\newspace-react\node_modules\escodegen\node_modules\esprima
npm WARN rm not removing C:\GitHub\newspace-react\node_modules\escodegen\node_modules\.bin\esvalidate.cmd as it wasn't installed by C:\GitHub\newspace-react\node_modules\escodegen\node_modules\esprima
npm WARN rm not removing C:\GitHub\newspace-react\node_modules\escodegen\node_modules\.bin\esparse as it wasn't installed by C:\GitHub\newspace-react\node_modules\escodegen\node_modules\esprima
npm WARN rm not removing C:\GitHub\newspace-react\node_modules\escodegen\node_modules\.bin\esvalidate as it wasn't installed by C:\GitHub\newspace-react\node_modules\escodegen\node_modules\esprima
npm WARN rm not removing C:\GitHub\newspace-react\node_modules\.bin\browserslist.cmd as it wasn't installed by C:\GitHub\newspace-react\node_modules\browserslist
npm WARN rm not removing C:\GitHub\newspace-react\node_modules\.bin\browserslist as it wasn't installed by C:\GitHub\newspace-react\node_modules\browserslist
npm WARN rm not removing C:\GitHub\newspace-react\node_modules\autoprefixer\node_modules\.bin\browserslist.cmd as it wasn't installed by C:\GitHub\newspace-react\node_modules\autoprefixer\node_modules\browserslist
npm WARN rm not removing C:\GitHub\newspace-react\node_modules\autoprefixer\node_modules\.bin\browserslist as it wasn't installed by C:\GitHub\newspace-react\node_modules\autoprefixer\node_modules\browserslist

> [email protected] install C:\GitHub\newspace-react\node_modules\yoga-layout
> npm run build:node


> [email protected] build:node C:\GitHub\newspace-react\node_modules\yoga-layout
> npm run copy-sources && autogypi && node-gyp configure build


> [email protected] copy-sources C:\GitHub\newspace-react\node_modules\yoga-layout
> ! npm -s run is-monolithic || (rsync -r --checksum --delete ../yoga/ sources/yoga/)

'!' is not recognized as an internal or external command,
operable program or batch file.
'rsync' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] copy-sources: `! npm -s run is-monolithic || (rsync -r --checksum --delete ../yoga/ sources/yoga/)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] copy-sources 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\soloy\AppData\Roaming\npm-cache\_logs\2018-07-02T07_57_07_316Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:node: `npm run copy-sources && autogypi && node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:node 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\soloy\AppData\Roaming\npm-cache\_logs\2018-07-02T07_57_07_415Z-debug.log
npm WARN [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
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: `npm run build:node`
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.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\soloy\AppData\Roaming\npm-cache\_logs\2018-07-02T07_57_18_226Z-debug.log

This is truly an issue with facebook/yoga. They may or may not work on the fix.

The related PR is still open since April 22, 2018... I wish @react-pdf did not depend on that library, but I have no idea of @react-pdf's code structure, so not proposing anything.

@mitkpl you can try using the workaround described here: https://github.com/diegomura/react-pdf/issues/211#issuecomment-399341196

There are more related open issues already, BTW:
https://github.com/diegomura/react-pdf/issues/185
https://github.com/diegomura/react-pdf/issues/151

Yeah, editing package.json to this

{
  "dependencies": {
    "yoga-layout": "github:naminho/yoga-layout-windows",
    "@react-pdf/core": "latest"
  }
}

... resolved the issue about installing dependencies. I will work on this to see if its ok to relate on this dep instead of original.

Duplicate #211

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dvenkatsagar picture dvenkatsagar  Â·  3Comments

mdodge-ecgrow picture mdodge-ecgrow  Â·  3Comments

brandly picture brandly  Â·  3Comments

emt1803 picture emt1803  Â·  3Comments

serkyen picture serkyen  Â·  4Comments