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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module '***' [Windows] #1852

Closed
cmzz opened this issue Jul 24, 2017 · 16 comments
Closed

Cannot find module '***' [Windows] #1852

cmzz opened this issue Jul 24, 2017 · 16 comments
Labels

Comments

@cmzz
Copy link

cmzz commented Jul 24, 2017

  • Version: 19.16.0
  • Target: windows 7 x64

Im building an app on windows. When build success and run app , then got error "Cannot find module "ultron".

If add "ultron" to dependencies, got an other error : "Cannot find module "safe-buffer".

I know issuse 217 but cannot work for me . module.paths is undifined ?

Anyone have ideas..

image

image

image

image

You see, if build on mac, more modules did put in than build on windows in win-unpacked\resources\app\node_modules folder

@cmzz
Copy link
Author

cmzz commented Jul 24, 2017

Config in packages.json

"build": {
    "asar": false,
    "productName": "pigtk-robot",
    "appId": "org.simulatedgreg.electron-vue",
    "directories": {
      "output": "build"
    },
    "files": [
      "dist/electron/**/*"
    ],
    "dmg": {
      "contents": [
        {
          "x": 410,
          "y": 150,
          "type": "link",
          "path": "/Applications"
        },
        {
          "x": 130,
          "y": 150,
          "type": "file"
        }
      ]
    },
    "mac": {
      "icon": "build/icons/icon.icns"
    },
    "win": {
      "icon": "build/icons/icon.ico",
      "publish": [
        "github"
      ],
      "target": "squirrel",
      "certificateFile": "./certs/pigtk-robot.pfx",
      "certificatePassword": "my_password"
    }
...
}

@cmzz cmzz changed the title Cannot find module 'xxxx' Cannot find module '***' [Windows] Jul 24, 2017
@hengkx
Copy link

hengkx commented Jul 24, 2017

try rebuild,electron-rebuild

@develar
Copy link
Member

develar commented Jul 24, 2017

@hengkx Not required, electron-builder automatically rebuilds.

@develar
Copy link
Member

develar commented Jul 24, 2017

Please set env DEBUG=electron-builder:* and attach log of the terminal output.

@cmzz
Copy link
Author

cmzz commented Jul 24, 2017

@develar Thanks for help.

image
image

@cmzz
Copy link
Author

cmzz commented Jul 24, 2017

@develar Its work fine with version 19.10.0

@develar
Copy link
Member

develar commented Jul 24, 2017

@cmzz Could you please provide project to reproduce?

@cmzz
Copy link
Author

cmzz commented Jul 24, 2017

@develar Sure

github repository

@cmzz
Copy link
Author

cmzz commented Jul 25, 2017

@develar Above version 19.13.0, Cannot pack all npm module.

19.13.0 => 2100+ object in build\win-unpacked\resources\app\node_modules
19.14.0 => 200 object in build\win-unpacked\resources\app\node_modules

image

@develar
Copy link
Member

develar commented Jul 25, 2017

Do you use npm or yarn? Please remove package-lock.json, yarn.lock and node_modules And install using yarn (not npm) again.

@develar
Copy link
Member

develar commented Jul 25, 2017

As far I see (in my case solution "remove package-lock.json" helps), DO NOT USE F**** NPM. Sorry for capslock, but please do not ever use npm and never store package-lock.json (if you use npm by error, remove created package-lock.json after it and use only yarn).

@develar
Copy link
Member

develar commented Jul 25, 2017

Tip: node-notifier not required anymore — latest electron can show notifications from main process.

@cmzz
Copy link
Author

cmzz commented Jul 25, 2017

@develar Aha thanks... Its work for me now. FUCK NPM

@hrwndr
Copy link

hrwndr commented Jul 29, 2021

Hi,
i solved it by migrating from npm to yarn.. that worked!!

@orzechdev
Copy link

I had the same issue with pnpm. After migrating to yarn the issue is solved. But what was the reason and why it doesn't work with pnpm?

@dieharders
Copy link

I spent all day trying to get this to work. Switching from PNPM to YARN worked for me. No idea why pnpm doesn't work but npm is referenced in the docs as if you have a choice but you dont.

Yarn should really be documented as the ONLY package manager that works with electron-builder (again, NO idea why? someone enlighten me?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants