napi-rs / napi-rs/node-rs

ERROR: This program cannot be run in DOS mode.

Open
#887 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.5k
Forks
52
Avg merge
13h 37m
Merged PRs (30d)
19

Description

Code:


import { Argon2id } from 'oslo/password';

/**
 * Hashes the password using Argon2id which is provided by the Oslo library
 * @param password - The password to hash
 * @returns The hashed password
 */
export const hashPassword = async (password: string) => {
  return new Argon2id().hash(password);
};

Error:

error during build:
[commonjs--resolver] node_modules/@node-rs/argon2-win32-x64-msvc/argon2.win32-x64-msvc.node (1:2): Unexpected character '�' (Note that you need plugins to import files that are not JavaScript)
file: C:/Users/User/Desktop/dashboard/node_modules/@node-rs/argon2/index.js:1:2

1: MZ����@���   �!�L�!This program cannot be run in DOS mode.
     ^
2: $z˰>w��>w��>w��76�2w��8���<w��8���/w��8���6w��8���:w��>w��Zw�����7w��S���?w��>w��<w��S���?w��S���?w��Rich>w...
3: `�0`@1��

RollupError: Unexpected character '�'
    at getRollupError (file:///C:/Users/User/Desktop/dashboard/node_modules/rollup/dist/es/shared/parseAst.js:392:41)
    at ParseError.initialise (file:///C:/Users/User/Desktop/dashboard/node_modules/rollup/dist/es/shared/node-entry.js:11494:28)
    at convertNode (file:///C:/Users/User/Desktop/dashboard/node_modules/rollup/dist/es/shared/node-entry.js:13192:10)
    at convertProgram (file:///C:/Users/User/Desktop/dashboard/node_modules/rollup/dist/es/shared/node-entry.js:12536:12)
    at Module.setSource (file:///C:/Users/User/Desktop/dashboard/node_modules/rollup/dist/es/shared/node-entry.js:14355:24)
    at async ModuleLoader.addModuleSource (file:///C:/Users/User/Desktop/dashboard/node_modules/rollup/dist/es/shared/node-entry.js:19046:13)
error: script "build.client" exited with code 1
error: script "preview" exited with code 1

vite.config.ts


export default defineConfig(({ command, mode }): UserConfig => {
  return {
   optimizeDeps: {
      exclude: [ "@node-rs/argon2" , "@node-rs/bcrypt"],
    },
...
}

Framework: Qwik
Node: v20.17.0
Windows 11 x64

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the password import and the optimizeDeps section in vite.config.ts, then run the reported build on Windows 11 with Node v20.17.0. Trace how @node-rs/argon2 is handled during the client build; done means the provided Qwik project builds and previews without Rollup parsing the native .node file.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.