← All tasks
javascriptnode-fetch/node-fetch #907Not a task: not reproduced

Bug: 3.0.0-beta.7's package.json cannot be required in nodejs ^12.7.0

envgap__node-fetch__node-fetch-907

01 / FAILURE SIGNATURE

As reported upstream

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in /Users/wheresrhys/Projects/fetch-mock/node_modules/node-fetch/package.json
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
ca50c22e3410ee288a7b4a8a89384d6df95ae3b6
Manifest
package.json
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

node-fetch/node-fetch #907 · read the original issue
<!--- Provide a clear and concise description of what the bug is. -->



**Reproduction**



Steps to reproduce the behaviour:



1. Install nodejs 12.7.0 and node-fetch@latest

2. Create a script containing `require('node-fetch/package.json')`

3. Run the script

4. 



```

$ node nf.js

internal/modules/cjs/loader.js:491

  throw new ERR_PACKAGE_PATH_NOT_EXPORTED(basePath, mappingKey);

  ^



Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in /Users/wheresrhys/Projects/fetch-mock/node_modules/node-fetch/package.json

    at applyExports (internal/modules/cjs/loader.js:491:9)

    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:953:27)

    at Function.Module._load (internal/modules/cjs/loader.js:842:27)

    at Module.require (internal/modules/cjs/loader.js:1026:19)

    at require (internal/modules/cjs/helpers.js:72:18)

    at Object.<anonymous> (/Users/wheresrhys/Projects/fetch-mock/nf.js:1:1)

    at Module._compile (internal/modules/cjs/loader.js:1138:30)

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10) {

  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'

}



```



**Expected behaviour**



No error (as is the case with node-fetch@2.x or node-fetch@latest with nodejs<12.7.0)



**Your Environment**







| software         | version

| ---------------- | -------

| node-fetch       | 3.0.0-beta.7

| node             | 12.7.0 (also recreated in 12.8.0 and 12.8.3)

| npm              | 6.14.4

| Operating System | MacOS 10.14.6 (Mojave) + iTerm running bash



**Additional context**



TBH this feels like it could be a bug in nodejs (side effect of [removing the experimental-modules flag?](https://github.com/nodejs/node/releases/tag/v12.17.0)), but thought I'd raise here first as you're more likely to know any context relevant to the node-fetch library I may have missed
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]