electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.7k stars 1.74k forks source link

Unresolved native module #2241

Closed kennir closed 7 years ago

kennir commented 7 years ago

Which version of electron-builder are you using? 19.42.2

What target are you building for? --win --ia32

Unresolved native module

I have clone a boilerplate project from this repo.

chentsulin/electron-react-boilerplate

Then goto app folder install native module 'node-printer'

npm install printer --save

the boilerplate project will auto rebuild native module successes add some reference in main.dev.js

import * as printer from 'printer';
console.log(printer.getPrinters());

in the root folder

npm run dev

It's seems ok, information of installed printers output to console

but when I want package the project. an error encountered

npm run package-win

...
 electron-builder Two package.json structure is used (dev: C:\Users\kenni\Developer\erp-printer\package.json, app: C:\Users\kenni\Developer\erp-printer\app\package.json) +1s
 electron-builder Unresolved dependencies after first round: printer +181ms
️  Unresolved node modules: printer
...

so why package-builder can not find module printer ? How can I fix it ?

Thank you!

kennir commented 7 years ago

use Yarn OK