Bug description
Error during build. Error: Failed to locate module "electron"
Steps to reproduce
nativefier -n "Title" --maximize --single-instance --file-download-options '{"saveAs": true}' --darwin-dark-mode-support --internal-urls ".*?" --honest --app-copyright "CR" -m --enable-es3-apis --clear-cache "https://google.com" --verbose
Expected behavior
build with no errors
Actual behavior
Error during build. Error: Failed to locate module "electron"
Logs & screenshots
Error during build. Run with --verbose for details. Error: Failed to locate module "electron" from "/var/folders/7w/7yy6swc97g325hbgl5s_jytc0000gn/T/nativefier-7-56-40-app-3169J9OGbDUqBSVb"
This normally means that either you have deleted this package already somehow (check your ignore settings if using electron-packager). Or your module installation failed.
at Walker.<anonymous> (/usr/local/lib/node_modules/nativefier/node_modules/flora-colossus/src/Walker.ts:71:13)
at step (/usr/local/lib/node_modules/nativefier/node_modules/flora-colossus/lib/Walker.js:32:23)
at Object.next (/usr/local/lib/node_modules/nativefier/node_modules/flora-colossus/lib/Walker.js:13:53)
at fulfilled (/usr/local/lib/node_modules/nativefier/node_modules/flora-colossus/lib/Walker.js:4:58)
Context
Probably related to https://github.com/jiahaog/nativefier/issues/923 . How did the installation of Nativefier itself go? Did you get an error at install time? If you install it globally, did you do so using sudo in a system path?
I just did a fresh install of osx, installed npm via homebrew, then nativefier, and also have this problem. No sudo has been used.
Here's the install of nativefier itself:
Desktop ➤ npm install nativefier -g
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
/usr/local/bin/nativefier -> /usr/local/lib/node_modules/nativefier/lib/cli.js
> [email protected] postinstall /usr/local/lib/node_modules/nativefier/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
> [email protected] postinstall /usr/local/lib/node_modules/nativefier
> cd app && echo '***** Installation will take 60s to finish, this is a bug ( https://github.com/jiahaog/nativefier/issues/923 ) that will be addressed in a future release. For now, have a cup of tea. *****' && npm install --no-package-lock --no-audit --silent
***** Installation will take 60s to finish, this is a bug ( https://github.com/jiahaog/nativefier/issues/923 ) that will be addressed in a future release. For now, have a cup of tea. *****
+ [email protected]
added 44 packages from 54 contributors in 61.955s
+ [email protected]
added 287 packages from 332 contributors in 71.197s
Used at:
```~ ➤ nativefier https://di.fm/ --name di.fm
Preparing Electron app...
Converting icons...
Packaging... This will take a few seconds, maybe minutes if the requested Electron isn't cached yet...
Packaging app for platform darwin x64 using electron v8.1.1
Error during build. Run with --verbose for details. Error: Failed to locate module "electron" from "/var/folders/f9/kg4369057436r9_vs_r6dc300000gn/T/nativefier-16-0-35-app-5639nsQnQUmh4giw"
This normally means that either you have deleted this package already somehow (check your ignore settings if using electron-packager). Or your module installation failed.
at Walker.<anonymous> (/usr/local/lib/node_modules/nativefier/node_modules/flora-colossus/src/Walker.ts:71:13)
at step (/usr/local/lib/node_modules/nativefier/node_modules/flora-colossus/lib/Walker.js:32:23)
at Object.next (/usr/local/lib/node_modules/nativefier/node_modules/flora-colossus/lib/Walker.js:13:53)
at fulfilled (/usr/local/lib/node_modules/nativefier/node_modules/flora-colossus/lib/Walker.js:4:58)```
@marcelocecin @waterelder issue _may_ be fixed with Nativefier 8.0.4 just published on npm. Can you give it a try? npm install -g [email protected] and retry building your apps 🙂.
I've uninstalled nativefier with npm and installed version 8.0.4 and the building process works. 👍