jkroso / parse-duration

convert a human readable duration to ms
MIT License
243 stars 37 forks source link

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main resolved in ${path}/node_modules/parse-duration/package.json #20

Closed cressie176 closed 4 years ago

cressie176 commented 4 years ago

Hi. Thanks for parse-duration, I've been using it in loads of my libraries, however it's started failing under Node 14. I'm probably missing something obvious, getting the following error...

$ node --version
v14.2.0
$ node
Welcome to Node.js v14.2.0.
Type ".help" for more information.
> const parse = require('parse-duration');
Uncaught:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main resolved in /Users/steve/Development/cressie176/pipsqueak/node_modules/parse-duration/package.json
    at resolveExportsTarget (internal/modules/cjs/loader.js:596:11)
    at applyExports (internal/modules/cjs/loader.js:454:14)
    at resolveExports (internal/modules/cjs/loader.js:507:23)
    at Function.Module._findPath (internal/modules/cjs/loader.js:635:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1007:27)
    at Function.Module._load (internal/modules/cjs/loader.js:890:27)
    at Module.require (internal/modules/cjs/loader.js:1080:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at repl:1:15
    at Script.runInThisContext (vm.js:131:20) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Any ideas?

dy commented 4 years ago

Whoops, sorry for the error. Fixed in 0.4.1

cressie176 commented 4 years ago

Same issue with 0.4.1 :(

dy commented 4 years ago

Ok, now is done in 0.4.2. Node ESM has implicit conventions, hence the issue.

cressie176 commented 4 years ago

Working again now. Thanks for responding so quickly.