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

libs/rollup: Build issue #125

Closed darbysauter closed 4 years ago

darbysauter commented 4 years ago

I am new to building js packages, I come from mainly java, kotlin, native, etc. So maybe I just don't understand this.

I cloned the repo, tried building using "npm run build" and "npm run-script build" but I keep getting:

> espruino@0.1.31 build /Users/mumphus/Documents/temp/EspruinoTools
> cd libs/rollup && npm install && npm run build

npm WARN deprecated rollup-plugin-json@3.1.0: This module has been deprecated and is no longer maintained. Please use @rollup/plugin-json.
npm WARN deprecated rollup-plugin-commonjs@9.3.4: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-commonjs.
npm WARN deprecated rollup-plugin-node-resolve@3.4.0: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-node-resolve.
npm WARN deprecated rollup-plugin-alias@1.5.2: This module has moved and is now available at @rollup/plugin-alias. Please update your dependencies. This version is no longer maintained.
npm WARN deprecated object-keys@0.2.0: Please update to the latest object-keys
npm notice created a lockfile as package-lock.json. You should commit this file.
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 espruino-rollup@0.1.0 No repository field.

added 155 packages from 232 contributors and audited 155 packages in 5.308s

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

found 3 moderate severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details

> espruino-rollup@0.1.0 build /Users/mumphus/Documents/temp/EspruinoTools/libs/rollup
> rollup -c

espruino-rollup.js → espruino-rollup.browser.js...
[!] Error: 'isCore' is not exported by node_modules/resolve/index.js
https://rollupjs.org/guide/en#error-name-is-not-exported-by-module-
node_modules/rollup-plugin-espruino-modules/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.es.js (3:9)
1: import { statSync, existsSync, realpathSync } from 'fs';
2: import { resolve, dirname, sep, basename, extname, normalize } from 'path';
3: import { isCore, sync } from 'resolve';
            ^
4: import { makeLegalIdentifier, attachScopes, extractAssignedNames, createFilter } from 'rollup-pluginutils';
5: import { walk } from 'estree-walker';
Error: 'isCore' is not exported by node_modules/resolve/index.js
    at error (/Users/mumphus/Documents/temp/EspruinoTools/libs/rollup/node_modules/rollup/dist/rollup.js:3460:30)
    at Module.error (/Users/mumphus/Documents/temp/EspruinoTools/libs/rollup/node_modules/rollup/dist/rollup.js:13349:9)
    at handleMissingExport (/Users/mumphus/Documents/temp/EspruinoTools/libs/rollup/node_modules/rollup/dist/rollup.js:13039:21)
    at Module.traceVariable (/Users/mumphus/Documents/temp/EspruinoTools/libs/rollup/node_modules/rollup/dist/rollup.js:13453:17)
    at ModuleScope.findVariable (/Users/mumphus/Documents/temp/EspruinoTools/libs/rollup/node_modules/rollup/dist/rollup.js:12726:29)
    at FunctionScope.Scope.findVariable (/Users/mumphus/Documents/temp/EspruinoTools/libs/rollup/node_modules/rollup/dist/rollup.js:4022:68)
    at Scope.findVariable (/Users/mumphus/Documents/temp/EspruinoTools/libs/rollup/node_modules/rollup/dist/rollup.js:4022:68)
    at BlockScope.Scope.findVariable (/Users/mumphus/Documents/temp/EspruinoTools/libs/rollup/node_modules/rollup/dist/rollup.js:4022:68)
    at ReturnValueScope.Scope.findVariable (/Users/mumphus/Documents/temp/EspruinoTools/libs/rollup/node_modules/rollup/dist/rollup.js:4022:68)
    at Scope.findVariable (/Users/mumphus/Documents/temp/EspruinoTools/libs/rollup/node_modules/rollup/dist/rollup.js:4022:68)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! espruino-rollup@0.1.0 build: `rollup -c`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the espruino-rollup@0.1.0 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!     /Users/mumphus/.npm/_logs/2020-07-31T19_42_28_342Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! espruino@0.1.31 build: `cd libs/rollup && npm install && npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the espruino@0.1.31 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mumphus/.npm/_logs/2020-07-31T19_42_28_371Z-debug.log

Which looks like the line Error: 'isCore' is not exported by node_modules/resolve/index.js is what is causing it to fail, Which is a part of the resolve package. So I tried "npm install resolve" and tried building, but no success.

Some build instructions would be nice in the README

gfwilliams commented 4 years ago

I don't know enough about rollup to help I'm afraid - but what exactly are you trying to accomplish here?

Usually just npm install in the root of EspruinoTools should be enough to get it so you can use it./

darbysauter commented 4 years ago

I never got it to work, but all I was trying to do was step through this program to see how updating works as I would like to do it from my android app. I got it to run in a debugger by running bin/espruino-cli.js with vscode.

I appreciate the effort!

gfwilliams commented 4 years ago

Ahh, ok - then you shouldn't need to do any of that at all. Just npm install and bin/espruino-cli.js should be enough.

If you've got any questions about the upload process feel free to ask on the forum.

You might also find that if you're looking at Bluetooth Low Energy, https://github.com/espruino/BangleApps/blob/master/bin/apploader.js is a less complex thing to look at.

It's meant for Bangle.js but the same basic things (BLE connection, upload to Storage) apply to all BLE Espruino devices.