espruino / EspruinoTools

JavaScript library of tools for Espruino - used for the Web IDE, CLI, etc.
Apache License 2.0
150 stars 89 forks source link

unable to install on macos #115

Closed opichals closed 4 years ago

opichals commented 4 years ago
$ node -v
v10.19.0
$ npm -v
6.13.4

$ npm i espruino@latest 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: winnus (node_modules/espruino/node_modules/winnus):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for winnus@0.0.5: wanted {"os":"win32","arch":"any"} (current: {"os":
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @abandonware/bluetooth-hci-socket@^0.5.3-3 (node_modules/@abandonware/noble/node_modules
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @abandonware/bluetooth-hci-socket@0.5.3-4: wanted {"os":"linux,an

npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for windows-build-tools@5.2.2: wanted {"os":"win32","arch":"any"} (current: {"os":"darwin","arch":"
npm ERR! notsup Valid OS:    win32
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   darwin
npm ERR! notsup Actual Arch: x64
gfwilliams commented 4 years ago

Does EspruinoTools not install at all? winnus should be the thing requiring windows-build-tools, but it exists only for windows compatibility and so is marked optional.

Unless windows-build-tools is required somewhere else - but I don't see it in EspruinoTools package.json...

If there's a way to require winnus only on windows I'd love to implement it, but making it optional with {"os":"win32","arch":"any"} seemed the best way

opichals commented 4 years ago

No node_modules folder created. Doesn't install at all.

It almost looks like an npm problem as when I use Linux the install ignores that package as optional and goes on without issues...

opichals commented 4 years ago

The https://www.npmjs.com/package/windows-build-tools#usage says it should be installed as --global. Perhaps it is not intended to be a dependency?

There are various issues reported and the solution I found is mostly to use it as --global install. See https://github.com/search?q=npm+ERR%21+code+EBADPLATFORM+npm+ERR%21+notsup+Unsupported+platform+for+windows-build-tools&type=Issues

opichals commented 4 years ago

Perhaps moving this https://github.com/espruino/winnus/blob/master/package.json#L24 to optionalDependencies would do the trick?

gfwilliams commented 4 years ago

Ahh, that's a shame. We could give it a try, but I guess it may just have to be global after all... Is it something you can do easily, or shall I push the change?

Sure seems like an NPM issue though - you'd think that any problem with an optional dependency would mean that the install continued, but just without that package.

opichals commented 4 years ago

We could give it a try, but I guess it may just have to be global after all... Is it something you can do easily, or shall I push the change?

I think it could work. Perhaps the npm on macos has a bug of not treating dependencies of packages installed via optionalDependencies as optional.

I'd prefer you push the change for a quick test.

gfwilliams commented 4 years ago

just done

opichals commented 4 years ago

@gfwilliams That did the trick! Thank you!

now it finishes the install on my MacOS machine:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: winnus (node_modules/espruino/node_modules/winnus):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for winnus@0.0.6: wanted {"os":"win32","arch":"any"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @abandonware/bluetooth-hci-socket@^0.5.3-3 (node_modules/@abandonware/noble/node_modules/@abandonware/bluetooth-hci-socket):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @abandonware/bluetooth-hci-socket@0.5.3-4: wanted {"os":"linux,android,freebsd,win32","arch":"any"} (current: {"os":"darwin","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: windows-build-tools (node_modules/winnus/node_modules/windows-build-tools):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for windows-build-tools@5.2.2: wanted {"os":"win32","arch":"any"} (current: {"os":"darwin","arch":"x64"})
npm WARN enoent ENOENT: no such file or directory, open '/private/tmp/esp/package.json'
npm WARN rollup-plugin-commonjs@10.1.0 requires a peer of rollup@>=1.12.0 but none is installed. You must install peer dependencies yourself.
npm WARN esp No description
npm WARN esp No repository field.
npm WARN esp No README data
npm WARN esp No license field.

+ espruino@0.1.30
added 169 packages from 203 contributors and audited 434 packages in 164.517s

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

found 0 vulnerabilities