Skip to content

[MODULE_NOT_FOUND] when pkg project with axios + get-intrinsic v1.3.1 #195

@emmansun

Description

@emmansun

What version of pkg are you using?

6.6.0

What version of Node.js are you using?

20.19.4

What operating system are you using?

Both Windows & Linux

What CPU architecture are you using?

x86_64

What Node versions, OSs and CPU architectures are you building for?

node20-windows-x64 node20-linux-x64

Describe the Bug

axios depends on form-data -> es-set-tostringtag -> get-intrinsic -> async-function, when we use get-intrinsic with version 1.3.1, It reports below errors:

PS D:\github\asynfunissue> .\asynfunissue.exe
pkg/prelude/bootstrap.js:1876
      throw error;
      ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\snapshot\asynfunissue\node_modules\async-function\index.js' imported from C:\snapshot\asynfunissue\node_modules\async-function\require.mjs
Did you mean to import "../../../../../D:/github/asynfunissue/index.js"?
    at finalizeResolution (node:internal/modules/esm/resolve:283:11)
    at moduleResolve (node:internal/modules/esm/resolve:952:10)
    at defaultResolve (node:internal/modules/esm/resolve:1188:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:642:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:591:25)
    at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:347:53)
    at new ModuleJobSync (node:internal/modules/esm/module_job:333:34)
    at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:320:11)
    at Object.loadESMFromCJS [as .mjs] (node:internal/modules/cjs/loader:1371:24)
    at Module.load (node:internal/modules/cjs/loader:1275:32) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///C:/snapshot/asynfunissue/node_modules/async-function/index.js'
}

Node.js v20.19.4

Expected Behavior

can work normally.

To Reproduce

Test file is as below:
index.js

const axios = require('axios');

axios({
    url: "https://www.google.com", 
    method: "GET",
}).then((response) => {
    console.log(response.data);
}).catch((error) => {
    console.error("Error fetching data:", error);
});

package.json

{
  "name": "asynfunissue",
  "version": "1.0.0",
  "main": "index.js",
  "bin": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": "",
  "dependencies": {
    "axios": "^1.13.2"
  },
  "overrides": {
    "get-intrinsic": "1.3.1"
  },
  "pkg": {
    "scripts": [
      "./index.js"
    ],
    "targets": [
      "node20-windows-x64"
    ],
    "assets":         [
      "./node_modules/**"
    ]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions