electron-userland / electron-prebuilt-compile

electron-prebuilt with Babel and React built-in
167 stars 50 forks source link

Strange error: 'Cannot find package.json' #56

Closed okdistribute closed 6 years ago

okdistribute commented 6 years ago

Seeing this error trying to use electron-forge with an es6 app, see related issue: https://github.com/electron-userland/electron-forge/issues/441

It works for my colleague on his linux machine but not on my machine. This is the repo in question: https://github.com/digidem/mapfilter-desktop

Why does this error get called and how can we fix it? There is a package.json in the repo.


$ DEBUG=electron-forge:* npm start

> mapfilter-desktop@0.5.0 start /Users/karissa/node_modules/mapfilter-desktop
> electron-forge start

WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Checking your system +0ms
  electron-forge:lifecycle Process Succeeded: Checking your system +284ms
  electron-forge:runtime-config setting key: verbose to value: false +0ms
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Locating Application +0ms
  electron-forge:project-resolver searching for project in: /Users/karissa/node_modules/mapfilter-desktop +0ms
  electron-forge:project-resolver electron-forge compatible package.json found in /Users/karissa/node_modules/mapfilter-desktop/package.json +5ms
  electron-forge:lifecycle Process Succeeded: Locating Application +6ms
  electron-forge:lifecycle Process Started: Preparing native dependencies +5ms
  electron-forge:lifecycle Process Succeeded: Preparing native dependencies +442ms
  electron-forge:hook could not find hook: generateAssets +0ms
  electron-forge:lifecycle Process Started: Launching Application +2ms
  electron-forge:lifecycle Process Succeeded: Launching Application +4ms
App threw an error during load
Error: Can't find package.json
    at findPackageJson (/Users/karissa/node_modules/mapfilter-desktop/node_modules/electron-prebuilt-compile/lib/es6-init.js:19:11)
    at findPackageJson (/Users/karissa/node_modules/mapfilter-desktop/node_modules/electron-prebuilt-compile/lib/es6-init.js:29:10)
    at findPackageJson (/Users/karissa/node_modules/mapfilter-desktop/node_modules/electron-prebuilt-compile/lib/es6-init.js:29:10)
    at findPackageJson (/Users/karissa/node_modules/mapfilter-desktop/node_modules/electron-prebuilt-compile/lib/es6-init.js:29:10)
    at findPackageJson (/Users/karissa/node_modules/mapfilter-desktop/node_modules/electron-prebuilt-compile/lib/es6-init.js:29:10)
    at main (/Users/karissa/node_modules/mapfilter-desktop/node_modules/electron-prebuilt-compile/lib/es6-init.js:44:23)
    at Object.<anonymous> (/Users/karissa/node_modules/mapfilter-desktop/node_modules/electron-prebuilt-compile/lib/es6-init.js:59:1)
    at Object.<anonymous> (/Users/karissa/node_modules/mapfilter-desktop/node_modules/electron-prebuilt-compile/lib/es6-init.js:61:3)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
^C```
okdistribute commented 6 years ago

I had originally cloned it in my ~/node_modules folder, which is where I have all of my node projects because then I can easily swap out dependencies. Cloning in a bare folder without this (e.g., ~/dev) then worked.