sindresorhus / electron-context-menu

Context menu for your Electron app
MIT License
1.39k stars 157 forks source link

Failed to locate module "cli-truncate" #177

Closed HanHan666666 closed 4 months ago

HanHan666666 commented 4 months ago

I introduced the dependency, and then after the following configuration, and then packaging, there is the following error, I do not know why, I do not have any operation errors, it looks like a bug, I would like to consult. But I can avoid this problem by adding the command line parameter "--ignore=node_modules" through packaging. The win option removed the parameter "--ignore=node_modules". Packaging failed and the error shown in the screenshot was encountered.

{
  "name": "chatgpt-zwu",
  "version": "1.0.0",
  "description": "gpt client",
  "main": "./src/main.js",
  "type": "module",
  "scripts": {
    "dev": "electron .",
    "build:win": "npx @electron/packager . ChatGPT-ZWU --platform=win32 --arch=x64  --out=./release-builds --overwrite",
    "build:mac": "npx @electron/packager . ChatGPT-ZWU --platform=darwin --arch=x64 --ignore=node_modules --out=./release-builds --overwrite",
    "build:dmg": "npx electron-builder --mac --x64"
  },
  "keywords": [
    "Electron",
    "quick",
    "start",
    "tutorial",
    "demo"
  ],
  "build": {
    "appId": "chatGPT",
    "electronDownload": {
      "mirror": "https://npmmirror.com/mirrors/electron/"
    }
  },
  "author": "WuHan",
  "devDependencies": {
    "@electron/packager": "^18.3.2",
    "electron": "^30.0.9",
    "electron-builder": "^24.13.3"
  },
  "dependencies": {
    "electron-context-menu": "^4.0.0"
  }
}

image

HanHan666666 commented 4 months ago

source_code.zip

HanHan666666 commented 4 months ago

https://github.com/electron-userland/electron-builder/issues/6471