LedgerHQ / ledgerjs

⛔️ MOVED to monorepo "ledger-live"
https://github.com/LedgerHQ/ledger-live
Apache License 2.0
574 stars 382 forks source link

yarn install failing #57

Closed ghost closed 5 years ago

ghost commented 6 years ago

Trying to verify that #15 is fixed, I cannot build the project:

$ yarn install
yarn install v1.3.2
$ node -e "if (process.env.npm_execpath.indexOf('yarn') === -1) { console.log('Please use yarn'); process.exit(1); }"
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
error flow-mono-cli@1.3.0: The engine "node" is incompatible with this module. Expected version ">=8.8.0".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

versions:

yarn --version
1.3.2
node --version
v9.4.0

On a Linux distribution.

meriadec commented 6 years ago

Hmm. I'm sorry but can't reproduce on my side with exact same version of node & yarn.

Given your error, is it possible that you have multiple node versions installed on your system, and for some obscure reason the wrong one is used while installing?

Here is my output ``` $ git clone git@github.com:LedgerHQ/ledgerjs.git Cloning into 'ledgerjs'... remote: Counting objects: 1880, done. remote: Compressing objects: 100% (98/98), done. remote: Total 1880 (delta 64), reused 101 (delta 41), pack-reused 1736 Receiving objects: 100% (1880/1880), 2.24 MiB | 472.00 KiB/s, done. Resolving deltas: 100% (1047/1047), done. $ cd ledgerjs $ yarn yarn install v1.3.2 $ node -e "if (process.env.npm_execpath.indexOf('yarn') === -1) { console.log('Please use yarn'); process.exit(1); }" [1/4] Resolving packages... [2/4] Fetching packages... info fsevents@1.1.3: The platform "linux" is incompatible with this module. info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation. info fsevents@1.1.2: The platform "linux" is incompatible with this module. info "fsevents@1.1.2" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... warning "workspace-aggregator-2c090ffc-6a6d-4348-9ba6-603a779df181 > @ledgerhq/react-native-hw-transport-ble@2.1.0" has unmet peer dependency "react-native-ble-plx@^0.8.0". warning "workspace-aggregator-2c090ffc-6a6d-4348-9ba6-603a779df181 > @ledgerhq/common > babel-jest@22.1.0" has unmet peer dependency "babel-core@^6.0.0 || ^7.0.0-0". [4/4] Building fresh packages... $ flow-mono create-symlinks packages/hw-transport/.flowconfig && flow-mono install-types --overwrite --ignoreDeps=peer || echo 'failed to setup flow-typed' ℹINFO::flow-mono-cli: Creating symlinks to the defined ".flowconfig" and dependencies to all packages with a "flow-bin" dependency. +0ms ✔SUCCESS::flow-mono-cli: Symlinking all direct dependencies of "14" packages done. +0ms ℹINFO::flow-mono-cli: Updating the global "flow-typed" defintions cache. +0ms ℹINFO::flow-mono-cli: Installing "flow-typed" defintions for dependencies in 14 packages. +0ms ✔SUCCESS::flow-mono-cli: Installing "flow-typed" defintions done. +0ms Done in 10.66s. $ yarn --version 1.3.2 $ node --version v9.4.0 ```
ghost commented 6 years ago

The system environment is probably the wildcard. Do you know a way to configure yarn to make the correct decision? Or what other commands can I issue to narrow this down?

AlainCo commented 6 years ago

I have the same problem on windows I tried to update all npm, node... Windows is W7 64bits (says: (current: {"os":"win32","arch":"ia32"}) ) yarn --version : 1.3.2 npm --version : 5.6.0 node -v : v6.10.1

the message is: info fsevents@1.1.3: The platform "win32" is incompatible with this module. info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation. error flow-mono-cli@1.3.0: The engine "node" is incompatible with this module. Expected version ">=8.8.0". error Found incompatible module

I'me beginner on node.js , so maybe I missed a trivial point.

gre commented 6 years ago

@AlainCo you need to have node >=8.8.0 at the moment because of flow-mono-cli. we're looking at ways to remove this dependency in the future because it is a dependency pain

AlainCo commented 6 years ago

Thanks for the hint, I've installed node v 8.9.4 LTS through MSI installer ( don't work through : npm install node -g). https://nodejs.org/en/ It pass compatibility phase, but yarn is running since 2 hours consuming 1 virtual core... I'm impatient but optimistic.

Best regards

AlainCo commented 6 years ago

Thre was progress, but on Windows 7 x64, yarn hangs inside flow-mono :

'C:\Local\ws\Workspace47\ledgerjs>yarn yarn install v1.3.2 $ node -e "if (process.env.npm_execpath.indexOf('yarn') === -1) { console.log('Please use yarn'); process.exit(1); }" [1/4] Resolving packages... success Already up-to-date. $ flow-mono create-symlinks packages/hw-transport/.flowconfig && flow-mono install-types --overwrite --ignoreDeps=peer || echo 'failed to setup flow-typed'

I tried to upgrade flow-mono, flow-mono-cli, but it changes nothing.

yarn --version : 1.3.2 node --version : v8.9.4 npm --version : 5.6.0 flow-mono --version : 1.3.0

gre commented 6 years ago

try removing the the flow-mono commands in the meantime, it only is used to generate the flow-typed/ folder, for flow. i'm not satisfied by this solution. we probably will figure out a better way...

AlainCo commented 6 years ago

I edited package.json "scripts": { ... "postinstall": "echo 'NO flow-mono create-symlinks nor install-types'",

It works better

when running yarn run build $ BABEL_ENV=production && yarn run documentation && lerna run build 'BABEL_ENV' is not recognized as an internal or external command... I edited similarily: build": "set BABEL_ENV=production && yarn run documentation && lerna run build",

$ set BABEL_ENV=production && yarn run documentation && lerna run build $ documentation build packages/hw-*/src/** packages/react-native-*/src/** --project-name '@ledgerhq/*' --project-versionnode -e "console.log(require('./lerna.json').version)"` --project-homepage https://github.com/LedgerHQ/ledgerjs --config documentation.yml -g -f html -o packages/documentation-website/public/docs node_modules\documentation\bin\documentation.js build [input..]

Options: --version Show version number [boolean] ... Unknown argument: e error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

I edited documentation: entry to suppress those scripts

it crashed again in "lerna" with few "export is not recognized as internal or external command..." in $ cd ../.. && export PATH=$(yarn bin):$PATH && cd - && babel --source-maps -d lib src && flow-copy-source -v src lib

I see 63 similar lines in the various package.json (common,exemple-browser/node,hw-app-bts/eth/xrp,hw-hid-cli,hw-http-proxy-devserver,hw-transport,hw-transport-http, hw-transport-node-hid,hw-transport-u2f,react-native-hid,react-native-hw-transport-ble,test

I suspect it is incompatibility with windows... I don't dare to edit all, as it seems bash script... maybe it is transcripted?

AlainCo commented 6 years ago

I tried to use "git bash for windows" , but there is no change on any point

EDIT: I've gone further. I commented the documentation call but lerna crash now on an export in this line cd ../.. && export PATH=$(yarn bin):$PATH && cd - && babel --source-maps -d lib src && flow-copy-source -v src lib

I find the code in the dozens of package.json in many folders

it seems incompatible with windows.

AlainCo commented 6 years ago

The situation is getting hellish. I've succeeded in using VirtualBox with Docker to compile with yarn (need activating symb links on shared volume ), but "yarn test-node" anyway fails on windows as "ledgerjs\node_modules\node-hid\build\Release\HID.node is not a valide Win32 application."

Win32 is apparently not supported, not even through docker "tricks".

How do people on Win32 work with ledger? I have missed a point because it seems too hard...

gre commented 6 years ago

Thanks for the investigation, I have no experience in development under Windows but one of our team member @amougel is using Windows too and recently ran into the same problem when trying to run the repository. We should try to fix this.

Some points to summarize what issues we have

Is that correct or did I miss something else?

AlainCo commented 6 years ago

Thanks for the directions. I will look at them. Someone also advised me to npm install ledgerco instead of building ledgerjs... It does not matter is the cat is grey or black, provided it catch the mouse... I'll try, thanks!

gre commented 6 years ago

ledgerco is the previous version of this library, unmaintained tho

AlainCo commented 6 years ago

ok, so I'll try to edit the build directives as suggested. for node-hid failure, I suspect it is because of crosscompilation with docker... I shoudl compile on win32, which requires changes of build scripts.

AlainCo commented 6 years ago

Thank you very much, finaly I succeded to compile consistently on Windows, from git-bash (seems not much improving, as script inside tarn is visibly CMD).

cross-env helped, and I just had to change le lines with BABEL_ENV=... I disabled all about documentation I disabled all about flow I edited the call to babel with PATH=...$(yarn bin), into just calling babel , but setting PATH to add c:...\ledgerjs\node_modules.bin

the node-test worked yarn run test-node

I'm totally new to node.js, so I cannot much help, except play the monkey tester.

At least the USB HID messages are passing, so I will be able to understand, and maybe convert the logic to what I know (java).