node.js - Error: Cannot find module in node_modules when running npm run dev - Stack Overflow

I am working on a Node.js project and using rspeedy for development. The project is built using a new p

I am working on a Node.js project and using rspeedy for development. The project is built using a new programming language and framework, and you can find more information on the Lynx Family GitHub page: .

When I run npm run dev, I get the following error:

PS D:\LYNX\lynx_first_project\bakakr> npm run dev

> [email protected] dev
> rspeedy dev

Rspeedy v0.8.2 (Rsbuild v1.2.11, Rspack v1.2.3)

start   Building...
error   Compile error: 
Failed to compile, check the errors for troubleshooting.
× Error: Cannot find module 'D:\LYNX\lynx_first_project\bakakr\node_modules\@lynx-js\tasm\build\win32\Release\lepus.node'
  │ Require stack:
  │ - D:\LYNX\lynx_first_project\bakakr\node_modules\@lynx-js\tasm\index.js
  │     at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
  │     at Module._load (node:internal/modules/cjs/loader:981:27)
  │     at Module.require (node:internal/modules/cjs/loader:1231:19)
  │     at require (node:internal/modules/helpers:177:18)
  │     at encode_napi (D:\LYNX\lynx_first_project\bakakr\node_modules\@lynx-js\tasm\index.js:48:17)
  │     at Object.fn (file:///D:/LYNX/lynx_first_project/bakakr/node_modules/@lynx-js/template-webpack-plugin/lib/LynxEncodePlugin

Steps I’ve tried to resolve the issue so far:

  1. Re-running npm install to ensure all dependencies are installed.
  2. Deleting node_modules and package-lock.json, then running npm install again.
  3. Running npm rebuild to rebuild the native modules.
  4. Checking whether the lepus.node file exists in the specified directory, but it is missing.
  5. Ensured I have Windows build tools installed using npm install --global windows-build-tools.

I am working on a Node.js project and using rspeedy for development. The project is built using a new programming language and framework, and you can find more information on the Lynx Family GitHub page: https://github/lynx-family.

When I run npm run dev, I get the following error:

PS D:\LYNX\lynx_first_project\bakakr> npm run dev

> [email protected] dev
> rspeedy dev

Rspeedy v0.8.2 (Rsbuild v1.2.11, Rspack v1.2.3)

start   Building...
error   Compile error: 
Failed to compile, check the errors for troubleshooting.
× Error: Cannot find module 'D:\LYNX\lynx_first_project\bakakr\node_modules\@lynx-js\tasm\build\win32\Release\lepus.node'
  │ Require stack:
  │ - D:\LYNX\lynx_first_project\bakakr\node_modules\@lynx-js\tasm\index.js
  │     at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
  │     at Module._load (node:internal/modules/cjs/loader:981:27)
  │     at Module.require (node:internal/modules/cjs/loader:1231:19)
  │     at require (node:internal/modules/helpers:177:18)
  │     at encode_napi (D:\LYNX\lynx_first_project\bakakr\node_modules\@lynx-js\tasm\index.js:48:17)
  │     at Object.fn (file:///D:/LYNX/lynx_first_project/bakakr/node_modules/@lynx-js/template-webpack-plugin/lib/LynxEncodePlugin

Steps I’ve tried to resolve the issue so far:

  1. Re-running npm install to ensure all dependencies are installed.
  2. Deleting node_modules and package-lock.json, then running npm install again.
  3. Running npm rebuild to rebuild the native modules.
  4. Checking whether the lepus.node file exists in the specified directory, but it is missing.
  5. Ensured I have Windows build tools installed using npm install --global windows-build-tools.
Share asked Mar 7 at 10:48 Abuubakar CiiseAbuubakar Ciise 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

Step-by-Step Guide to Fix the Issue:

  1. Create a new Rspeedy project:

    npm create rspeedy@latest
    
  2. Navigate to the project directory:

    cd 'project_name'
    
  3. Modify the package.json:

    • Search for "@lynx-js/react-rsbuild-plugin": "^0.9.0" and change it to:
      "@lynx-js/react-rsbuild-plugin": "npm:@lynx-js/react-rsbuild-plugin-canary@^0.9.0"
      
  4. Run npm install:

    npm install
    
  5. Double-check package-lock.json:

    • Open package-lock.json and verify that the version for @lynx-js/react-rsbuild-plugin is resolved to @lynx-js/react-rsbuild-plugin-canary. It should look like:
      "node_modules/@lynx-js/react-rsbuild-plugin": {
        "name": "@lynx-js/react-rsbuild-plugin-canary",
        "version": "0.9.0",
        "resolved": "https://registry.npmjs./@lynx-js/react-rsbuild-plugin-canary/-/react-rsbuild-plugin-canary-0.9.0.tgz"
      }
      
  6. Fix the index.js file:

    • Open node_modules\@lynx-js\tasm\index.js, search for:
      let encode = encode_napi;
      
    • Change it to:
      let encode = getEncodeMode();
      

Thanks to Xuanyi Fu for providing the solution!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744935571a4601999.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信