Skip to content

package.json broken since esm #25

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
Maigre opened this issue Feb 12, 2020 · 4 comments
Closed

package.json broken since esm #25

Maigre opened this issue Feb 12, 2020 · 4 comments

Comments

@Maigre
Copy link

Maigre commented Feb 12, 2020

Hi,
adding esm export to package.json broke it:
it's forbidden to mix '.' starting entry with others that not starts with '.'
see https://nodejs.org/api/esm.html#esm_exports_sugar

Best

@MylesBorins
Copy link
Owner

Should be fixed in v4.1.5

Also feel free to check out node-osc@beta if you want to try the entirely ESM version of the package (with legacy CJS support). Dev work is in the next branch

@ffd8
Copy link

ffd8 commented Mar 1, 2020

Just updated my node + npm to latest versions to see if being outdated was what occasionally crashing nodejs while using osc – but now I can't activate my script... getting this strange error (using node-osc v4.1.5):

internal/modules/cjs/loader.js:635
  throw e;
  ^

Error: No valid exports main found for '/Users/_nameobscured_/Documents/_pathobscured_/_pathobscured_/p5live/node_modules/node-osc'
    at resolveExportsTarget (internal/modules/cjs/loader.js:632:9)
    at applyExports (internal/modules/cjs/loader.js:500:14)
    at resolveExports (internal/modules/cjs/loader.js:549:12)
    at Function.Module._findPath (internal/modules/cjs/loader.js:664:22)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:967:27)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/_nameobscured_/Documents/_pathobscured_/_pathobscured_/p5live/server.js:22:8)
    at Module._compile (internal/modules/cjs/loader.js:1151:30) {
  code: 'MODULE_NOT_FOUND'
}

Is this issue related to the same above? Having just updated to Node v13.8.0 + NPM v6.13.7. Worked fine previous with Node v12.1.0 + NPM v6.9.0...

@MylesBorins
Copy link
Owner

@ffd8 found the fix, exports for some reason is failing if you don't include ./ in the string. This is surprising behavior and inconsistent with how main works... I'm unsure if this was intentional or not but I've opened a bug in node.js about it.

Either way the fix was simple enough and I've published 4.1.6 which fixes the problem. Re-installing node modules in P5LIVE should fix this.

@ffd8
Copy link

ffd8 commented Mar 1, 2020

@MylesBorins thanks for the super quick fix! P5LIVE booted up just fine now. I thought it was osc-crash-free, but just experienced the same issue I've had before, so I'll put it as a new issue, #26 , since his one is solved.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants