question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Initial setup. Electron app error.

See original GitHub issue

Trying to run initial setup.

npm install -g @nrwl/schematics
npm install -g @angular/cli
create-nx-workspace apps-xplat

npm install @nstudio/schematics --save-dev
ng g xplat --prefix=foo --platforms=web,nativescript,ionic,electron,nest
ng g app devops
ng g app.electron devops --target=web-devops

All good until this point. But after npm i error appear.

Something related to fsevents and node 11.7 I guess. These lines are interesting I think:

WARN Pre-built binaries not found for fsevents@1.2.7 and electron@2.0.8
WARN Pre-built binaries not installable for fsevents@1.2.7 and electron@2.0.8

Full error:

npm WARN deprecated joi@9.2.0: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0

> apps-xplat@0.0.0 postinstall /Users/sasha/Dev/apps-xplat
> ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true npx electron-builder install-app-deps

  • electron-builder version=20.28.4
  • Unresolved node modules: @angular/http
  • rebuilding native production dependencies platform=darwin arch=x64
Error: /usr/local/Cellar/node/11.7.0/bin/node exited with code 1
Output:

> fsevents@1.2.7 install /Users/sasha/Dev/apps-xplat/node_modules/fsevents
> node install

  SOLINK_MODULE(target) Release/.node
  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node
Failed to execute '/usr/local/Cellar/node/11.7.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/sasha/Dev/apps-xplat/node_modules/fsevents/lib/binding/Release/electron-v2.0-darwin-x64/fse.node --module_name=fse --module_path=/Users/sasha/Dev/apps-xplat/node_modules/fsevents/lib/binding/Release/electron-v2.0-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
  COPY /Users/sasha/Dev/apps-xplat/node_modules/fsevents/lib/binding/Release/electron-v2.0-darwin-x64/fse.node
  TOUCH Release/obj.target/action_after_build.stamp

Error output:
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.7/fse-v1.2.7-electron-v2.0-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for fsevents@1.2.7 and electron@2.0.8 (electron-v2.0 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Pre-built binaries not installable for fsevents@1.2.7 and electron@2.0.8 (electron-v2.0 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Connection closed while downloading tarball file
rm: ./Release/.deps/Release/obj.target/fse/fsevents.o.d.raw: No such file or directory
make: *** [Release/obj.target/fse/fsevents.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:188:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/Cellar/node/11.7.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/sasha/Dev/apps-xplat/node_modules/fsevents/lib/binding/Release/electron-v2.0-darwin-x64/fse.node" "--module_name=fse" "--module_path=/Users/sasha/Dev/apps-xplat/node_modules/fsevents/lib/binding/Release/electron-v2.0-darwin-x64" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /Users/sasha/Dev/apps-xplat/node_modules/fsevents
gyp ERR! node -v v11.7.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/11.7.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/sasha/Dev/apps-xplat/node_modules/fsevents/lib/binding/Release/electron-v2.0-darwin-x64/fse.node --module_name=fse --module_path=/Users/sasha/Dev/apps-xplat/node_modules/fsevents/lib/binding/Release/electron-v2.0-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/sasha/Dev/apps-xplat/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:188:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:978:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/11.7.0/bin/node" "/Users/sasha/Dev/apps-xplat/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/sasha/Dev/apps-xplat/node_modules/fsevents
node-pre-gyp ERR! node -v v11.7.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fsevents@1.2.7 install: `node install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fsevents@1.2.7 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sasha/.npm/_logs/2019-02-20T22_21_46_544Z-debug.log

    at ChildProcess.childProcess.once.code (/Users/sasha/Dev/apps-xplat/node_modules/builder-util/src/util.ts:254:14)
    at Object.onceWrapper (events.js:276:13)
    at ChildProcess.emit (events.js:188:13)
    at maybeClose (internal/child_process.js:978:16)
    at Socket.stream.socket.on (internal/child_process.js:395:11)
    at Socket.emit (events.js:188:13)
    at Pipe._handle.close (net.js:609:12)
From previous event:
    at rebuild (/Users/sasha/Dev/apps-xplat/node_modules/app-builder-lib/out/util/yarn.js:239:18)
    at /Users/sasha/Dev/apps-xplat/node_modules/app-builder-lib/src/util/yarn.ts:20:11
From previous event:
    at installOrRebuild (/Users/sasha/Dev/apps-xplat/node_modules/app-builder-lib/out/util/yarn.js:68:17)
    at /Users/sasha/Dev/apps-xplat/node_modules/electron-builder/src/cli/install-app-deps.ts:56:9
    at Generator.next (<anonymous>)
From previous event:
    at installAppDeps (/Users/sasha/Dev/apps-xplat/node_modules/electron-builder/out/cli/install-app-deps.js:174:17)
    at then (/Users/sasha/Dev/apps-xplat/node_modules/electron-builder/src/cli/cli.ts:42:48)
    at processImmediate (timers.js:632:19)
From previous event:
    at Object.args [as handler] (/Users/sasha/Dev/apps-xplat/node_modules/electron-builder/src/cli/cli.ts:42:48)
    at Object.runCommand (/Users/sasha/Dev/apps-xplat/node_modules/electron-builder/node_modules/yargs/lib/command.js:238:44)
    at Object.parseArgs [as _parseArgs] (/Users/sasha/Dev/apps-xplat/node_modules/electron-builder/node_modules/yargs/yargs.js:1063:30)
    at Object.get [as argv] (/Users/sasha/Dev/apps-xplat/node_modules/electron-builder/node_modules/yargs/yargs.js:1004:21)
    at Object.<anonymous> (/Users/sasha/Dev/apps-xplat/node_modules/electron-builder/src/cli/cli.ts:25:28)
    at Module._compile (internal/modules/cjs/loader.js:721:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:774:12)
    at findNodeScript.then.existing (/Users/sasha/Dev/apps-xplat/node_modules/npx/node_modules/libnpx/index.js:268:14)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! apps-xplat@0.0.0 postinstall: `ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true npx electron-builder install-app-deps`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the apps-xplat@0.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sasha/.npm/_logs/2019-02-20T22_21_46_772Z-debug.log

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
NathanWalkercommented, Feb 24, 2019

In 7.3.1 I updated electron to latest v4 and ended up ensuring @angular/http is at least installed to avoid the need of using ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES keeping things simpler.

You can now simply run ng update @nstudio/schematics if using angular cli 7.3.x and above. If using previous angular cli version just note this here if using ng update 👍

1reaction
NathanWalkercommented, Feb 24, 2019

Ok @ph55 I have a fix for this now and am rolling into an xplat update today which updates all electron dependencies and postinstall. You can simply run ng update @nstudio/schematics now to fix or if you run into trouble with ng update you can make the following manual changes:

Open root package.json and make the following changes:

Add to dependencies

  • "@angular/http": "^7.0.0",

We could keep unresolved dep flag on electron but not worth it so just add this.

Modify devDependencies as follows:

    "electron": "^4.0.5",
    "electron-builder": "^20.38.4",
    "electron-rebuild": "~1.8.4",
    "electron-installer-dmg": "~2.0.0",
    "electron-packager": "~13.1.0",
    "electron-reload": "~1.4.0",
    "electron-store": "~2.0.0",
    "electron-updater": "~4.0.6",

That updates all electron dependencies and importantly adds electron-rebuild.

Modify scripts as follows:

"postinstall": "electron-rebuild install-app-deps",

Now modify your electron app apps/electron-devops/tsconfig.json as follows:

  • Add "types": ["jasmine"], so it should look like this:
{
  "compilerOptions": {
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "esModuleInterop": true,
    "target": "es5",
    "types": ["jasmine"],
    "typeRoots": ["../../node_modules/@types"],
    "lib": ["es2017", "es2016", "es2015", "dom"]
  },
  "include": ["src/index.ts"]
}

That’s needed to prevent jest types from colliding with jasmine as mentioned here.

Now clean and reinstall your workspace:

npm cache clean --force   // for good measure!
rm -rf node_modules package-lock.json 
npm i

You should now be able to run all apps including your electron app with:

npm run start.electron.devops

Lemme know if that gets you going and thanks for reporting this 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

electron quick start application not working - Stack Overflow
I'm new to electron and trying to follow different tutorials. Currently I'm following this link to Write my First Electron App.
Read more >
Quick Start | Electron
This guide will step you through the process of creating a barebones Hello World app in Electron, similar to electron/electron-quick-start.
Read more >
electron-packager - npm
npm install for the Foo Bar app has been run at least once. When one runs the following command for the first time...
Read more >
Creating an Electron application from scratch
Install the LTS (long-term support) version of Node from here if node -v doesn't give you sensible output on your computer's terminal/console. ( ......
Read more >
Electron Apps Made Easy with Create React App and Electron ...
If you ever need to wrap a React app in Electron, you'll surely find ... first two steps in this section and then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found