Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using Parcel v2 with Bun without an installed Node.js #9707

Closed
koddr opened this issue May 8, 2024 · 1 comment
Closed

Error when using Parcel v2 with Bun without an installed Node.js #9707

koddr opened this issue May 8, 2024 · 1 comment

Comments

@koddr
Copy link

koddr commented May 8, 2024

馃悰 bug report

I get error when using Parcel v2 in my project, when I use Bun without an installed Node.js.

馃帥 Configuration (.babelrc, package.json, cli command)

{
  "name": "project",
  "version": "0.0.0",
  "license": "MIT",
  "browserslist": "> 0.5%, last 2 versions, not dead",
  "source": [
    "./assets/scripts.js",
    "./assets/styles.scss"
  ],
  "targets": {
    "default": {
      "distDir": "./static"
    }
  },
  "scripts": {
    "watch": "parcel watch",
    "fmt": "prettier --write .",
    "dev": "parcel build --no-optimize",
    "build": "parcel build"
  },
  "dependencies": {
    "htmx.org": "latest"
  },
  "devDependencies": {
    "@parcel/transformer-sass": "latest",
    "parcel": "latest",
    "prettier": "latest"
  }
}

馃 Expected Behavior

Add support Bun without Node.js.

馃槸 Current Behavior

$ bun run build

3619 |                     (0, ($parcel$interopDefault($aniHR$module)))._extensions[".js"](m, filename);
3620 |                 };
3621 |             }
3622 |         }
3623 |         try {
3624 |             m.load(filePath);
                   ^
TypeError: m.load is not a function. (In 'm.load(filePath)', 'm.load' is undefined)
      at load (/Users/user/project/node_modules/@parcel/package-manager/lib/index.js:3624:13)

3619 |                     (0, ($parcel$interopDefault($aniHR$module)))._extensions[".js"](m, filename);
3620 |                 };
3621 |             }
3622 |         }
3623 |         try {
3624 |             m.load(filePath);
                   ^
TypeError: m.load is not a function. (In 'm.load(filePath)', 'm.load' is undefined)
      at load (/Users/user/project/node_modules/@parcel/package-manager/lib/index.js:3624:13)

3619 |                     (0, ($parcel$interopDefault($aniHR$module)))._extensions[".js"](m, filename);
3620 |                 };
3621 |             }
3622 |         }
3623 |         try {
3624 |             m.load(filePath);
                   ^
TypeError: m.load is not a function. (In 'm.load(filePath)', 'm.load' is undefined)
      at load (/Users/user/project/node_modules/@parcel/package-manager/lib/index.js:3624:13)

3619 |                     (0, ($parcel$interopDefault($aniHR$module)))._extensions[".js"](m, filename);
3620 |                 };
3621 |             }
3622 |         }
3623 |         try {
3624 |             m.load(filePath);
                   ^
TypeError: m.load is not a function. (In 'm.load(filePath)', 'm.load' is undefined)
      at load (/Users/user/project/node_modules/@parcel/package-manager/lib/index.js:3624:13)

10 |   }
11 | }
12 |
13 | let binding;
14 | try {
15 |   binding = require(name);
     ^
TypeError: symbol 'napi\_register\_module\_v1' not found in native module. Is this a Node API (napi) module?
      at dlopen (native:1:1)
      at /Users/user/project/node_modules/@parcel/watcher/index.js:15:2
      at anonymous (native:1:1)
      at /Users/user/project/node_modules/@parcel/fs/lib/index.js:21:5
      at anonymous (native:1:1)
      at /Users/user/project/node_modules/@parcel/package-manager/lib/index.js:35:5
      at anonymous (native:1:1)
      at /Users/user/project/node_modules/@parcel/core/lib/worker.js:102:1
      at anonymous (native:1:1)
      at /Users/user/project/node_modules/@parcel/workers/lib/child.js:111:19
10 |   }
11 | }
12 |
13 | let binding;
14 | try {
15 |   binding = require(name);
     ^
TypeError: symbol 'napi\_register\_module\_v1' not found in native module. Is this a Node API (napi) module?
      at dlopen (native:1:1)
      at /Users/user/project/node_modules/@parcel/watcher/index.js:15:2
      at anonymous (native:1:1)
      at /Users/user/project/node_modules/@parcel/fs/lib/index.js:21:5
      at anonymous (native:1:1)
      at /Users/user/project/node_modules/@parcel/package-manager/lib/index.js:35:5
      at anonymous (native:1:1)
      at /Users/user/project/node_modules/@parcel/core/lib/worker.js:102:1
      at anonymous (native:1:1)
      at /Users/user/project/node_modules/@parcel/workers/lib/child.js:111:19
10 |   }
11 | }
12 |
13 | let binding;
14 | try {
15 |   binding = require(name);
     ^
TypeError: symbol 'napi\_register\_module\_v1' not found in native module. Is this a Node API (napi) module?
      at dlopen (native:1:1)
      at /Users/user/project/node_modules/@parcel/watcher/index.js:15:2
      at anonymous (native:1:1)
      at /Users/user/project/node_modules/@parcel/fs/lib/index.js:21:5
      at anonymous (native:1:1)
      at /Users/user/project/node_modules/@parcel/package-manager/lib/index.js:35:5
      at anonymous (native:1:1)
      at /Users/user/project/node_modules/@parcel/core/lib/worker.js:102:1
      at anonymous (native:1:1)
      at /Users/user/project/node_modules/@parcel/workers/lib/child.js:111:19
10 |   }
11 | }
12 |
13 | let binding;
14 | try {
15 |   binding = require(name);
     ^
TypeError: symbol 'napi\_register\_module\_v1' not found in native module. Is this a Node API (napi) module?
      at dlopen (native:1:1)
      at /Users/user/project/node_modules/@parcel/watcher/index.js:15:2
      at anonymous (native:1:1)
      at /Users/user/project/node_modules/@parcel/fs/lib/index.js:21:5
      at anonymous (native:1:1)
      at /Users/user/project/node_modules/@parcel/package-manager/lib/index.js:35:5
      at anonymous (native:1:1)
      at /Users/user/project/node_modules/@parcel/core/lib/worker.js:102:1
      at anonymous (native:1:1)
      at /Users/user/project/node_modules/@parcel/workers/lib/child.js:111:19

Bun v1.1.7 (macOS arm64)
error: script "build" exited with code 1

馃拋 Possible Solution

Add types to resolve TypeError: symbol 'napi\_register\_module\_v1' not found in native module. Is this a Node API (napi) module? or something like this.

馃敠 Context

馃捇 Code Sample

馃實 Your Environment

$ node -v
zsh: command not found: node

$ npm -v
zsh: command not found: npm
Software Version(s)
Parcel v2.12.0
Node Bun v1.1.7
npm/Yarn Bun v1.1.7
Operating System macOS 14.4.1 (23E224)
@mischnic
Copy link
Member

mischnic commented May 8, 2024

We don't really support using Bun instead of Node.
This is rather that Bun doesn't have full compatibility with Node.js (yet), maybe you should report this to Bun.

@mischnic mischnic closed this as not planned Won't fix, can't repro, duplicate, stale May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants