Coder Social home page Coder Social logo

electron-windows-notifications's Introduction

electron-windows-notifications

Create native Windows toast and tile notifications for Windows 8, 8.1, and 10 using native bindings to WinRT (using NodeRT).

npm install --save electron-windows-notifications

From Electron v14 on, you'll have to require NodeRT modules in the main process. See NodeRT/NodeRT#158 for details.

Usage

For more samples, check out the samples folder.

📝 Want to respond to interactive notifications (with input fields, for instance)? You can send them with this module - and respond to them with electron-windows-interactive-notifications!

📝 Want to check if you should send a notification?, accounting for the user notification state and quiet hours? Check out electron-notification-state.

ToastNotification

The constructor for the ToastNotification class accepts an options object with the following properties:

  • string template - The XML template for the notification. You can also call new Template() with few properties to customize your own XML template based on the default. See example: template.js
  • string[] strings - An array of strings to be used in your template. XML escaping is applied to all strings.
  • Date expirationTime - Time after which a toast notification should not be displayed.
  • string group - Group identifier for the notification.
  • string tag - Unique identifier of this notification within the notification group.
  • string appId - appUserModelId of the application for which the notification is sent. If not passed, it will be assumed to be a global property in Electron's main thread.
const appId = 'electron-windows-notifications'
const {ToastNotification} = require('electron-windows-notifications')

let notification = new ToastNotification({
    appId: appId,
    template: `<toast><visual><binding template="ToastText01"><text id="1">%s</text></binding></visual></toast>`,
    strings: ['Hi!']
})

notification.on('activated', () => console.log('Activated!'))
notification.show()

TileNotification

Tile notifications update the app's primary or secondary tiles. They require that the app is running inside the UWP model, which is possible on Windows 10 Anniversary Update and later. For more information, check out electron-windows-store. The constructor for the TileNotification class accepts an options object with the following properties:

  • string template - The XML template for the notification. You can also call new Template() with few properties to customize your own XML template based on the default. See example: template.js
  • string[] strings - An array of strings to be used in your template. XML escaping is applied to all strings.
  • string tag - Unique identifier of this notification within the notification group.
  • string tileId - If set, the given tile will be updated. Otherwise, the app's primary tile will be used.
const appId = 'electron-windows-notifications'
const {ToastNotification} = require('electron-windows-notifications')

let notification = new ToastNotification({
    appId: appId,
    template: `<toast><visual><binding template="ToastText01"><text id="1">%s</text></binding></visual></toast>`,
    strings: ['Hi!']
})

notification.on('activated', () => console.log('Activated!'))
notification.show()

Hints

appUserModelId

The appUserModelId identifies application in Windows. In Electron, you can set it at runtime using the app.setAppUserModelId() method. If you don't pass it, this module will assume that it's a property on Electron's main thread. Unless running inside a UWP container, you probably want to pass it.

Mysterious Failures & XML Escaping

Microsoft follows the XML spec to the letter - and XML has escaping rules you might not be familiar with. If you're adding strings and properties to your template, consider just using the strings property in the constructor - it will automatically properly escape all input.

String replacement

Inside the module, util.format is used. It'll format the template in a printf-like format. The template is expected to hold zero or more placeholders. Each placeholder is replaced with the converted value from its corresponding argument. If the placeholder does not have a corresponding argument, the placeholder is not replaced. Supported placeholders are:

  • %s - String.
  • %d - Number (both integer and float).
  • %j - JSON.
  • %% - single percent sign ('%'). This does not consume an argument.

License

MIT. Please see LICENSE for details.

electron-windows-notifications's People

Contributors

anaisbetts avatar bitdisaster avatar danielfinke avatar felixrieseberg avatar kwonoj avatar marcbachmann avatar ritazh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

electron-windows-notifications's Issues

An unhandled error occurred inside electron-rebuild

$ ./node_modules/.bin/electron-rebuild -m ./app/node_modules

  • Searching dependency tree
    × Rebuild Failed

An unhandled error occurred inside electron-rebuild
ENOENT: no such file or directory, open 'C:\Users\CraigTaylor\develop\notifications-samples\samples\electron\app\node_modules\package.json'

Error: ENOENT: no such file or directory, open 'C:\Users\CraigTaylor\develop\notifications-samples\samples\electron\app\node_modules\package.json'

Can't install with yarn or npm

C:\Users\buds\Documents\GitHub\wa-update\node_modules\@nodert-win10-cu\windows.applicationmodel>if not defined npm_config_node_gyp (node "C:\Users\buds\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\buds\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Python37\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:291:12)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:961:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\buds\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\buds\Documents\GitHub\wa-update\node_modules\@nodert-win10-cu\windows.applicationmodel
gyp ERR! node -v v10.5.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @nodert-win10-cu/[email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @nodert-win10-cu/[email protected] 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!     C:\Users\buds\AppData\Roaming\npm-cache\_logs\2018-11-26T04_51_08_581Z-debug.log

I have a working python installed in this directory, but anyway that's kinda weird to ask for python on a npm module

could not find assembly 'platform.winmd'

while I am trying to install then getting following error:

fatal error C1107: could not find assembly
 'platform.winmd': please specify the assembly search path using /AI or by setting the LIBPATH environment variable

Example in readme throw error

I got an error after using example from readme

Uncaught (in promise) Error: Cannot find module '@nodert-win10-au/windows.ui.notifications'
    at Module._resolveFilename (module.js:485:15)
    at Function.Module._resolveFilename (C:\code\xxx\xxx\node_modules\electron-prebuilt-compile\node_modules\electron\dist\resources\electron.asar\common\reset-search-paths.js:35:12)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\code\xxx\xxx\node_modules\electron-windows-notifications\src\index.js:33:27)
    at Object.<anonymous> (C:\code\xxx\xxx\node_modules\electron-windows-notifications\src\index.js:47:3)
    at Module._compile (module.js:569:30)
    at Object.require.extensions.(anonymous function) [as .js] (C:\code\xxx\xxx\node_modules\electron-compile\lib\require-hook.js:77:14)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at ProxyComponent.App (C:\code\xxx\xxx\src\app.jsx:151:35)
    at App (eval at <anonymous> (C:\code\xxx\xxx\node_modules\react-hot-loader\dist\react-hot-loader.development.js:225:54), <anonymous>:5:7)
    at C:\code\xxx\xxx\node_modules\react-dom\lib\ReactCompositeComponent.js:292:18
    at measureLifeCyclePerf (C:\code\xxx\xxx\node_modules\react-dom\lib\ReactCompositeComponent.js:73:12)
    at ReactCompositeComponentWrapper._constructComponentWithoutOwner (C:\code\xxx\xxx\node_modules\react-dom\lib\ReactCompositeComponent.js:291:16)
    at ReactCompositeComponentWrapper._constructComponent (C:\code\xxx\xxx\node_modules\react-dom\lib\ReactCompositeComponent.js:282:19)
    at ReactCompositeComponentWrapper.mountComponent (C:\code\xxx\xxx\node_modules\react-dom\lib\ReactCompositeComponent.js:185:21)
    at Object.mountComponent (C:\code\xxx\xxx\node_modules\react-dom\lib\ReactReconciler.js:43:35)

if @nodert-win10-au/windows.ui.notifications is required should be included in dependency.

Plugin not working in Angular apps: You tried to use electron-windows-notifications, but you're not running Windows 10, 8.1, or 8

Hi,

we tried to use this plugin in an Angular app packaged using Electron. When trying to use notifications, I received this warning:

You tried to use electron-windows-notifications, but you're not running Windows 10, 8.1, or 8. No operations will be performed.

This is because Angular also declares a global variable "process". In this line, the process variable is the Angular one, not the Node one, so process.platform is undefined and it thinks the environment isn't Windows.

I was able to fix this by adding this line to the start of index.js:

const process = require('process')

I'm not sure if this is the best approach to fix the issue, so I prefer opening an issue instead of sending a PR.

None of the notification test works

electron-windows-notifications\samples\electron> npm install
electron-windows-notifications\samples\electron> npm run start

it pops up the electron app. if I click on any of the notification button it does nothing :(

Error running 3.0.1 (not present in 2.0.1)

I'm getting the following error when trying to run 3.0.1:

App threw an error during load
Error: A dynamic link library (DLL) initialization routine failed.
...\node_modules@nodert-win10-cu\windows.ui.notifications\build\Release\binding.node
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:172:20)
at Object.Module._extensions..node (module.js:598:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:172:20)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object. (...\node_modules@nodert-win10-cu\windows.ui.notifications\lib\main.js:25:20)
at Object. (...\node_modules@nodert-win10-cu\windows.ui.notifications\lib\main.js:69:3)

Note that everything builds correctly and that 2.0.1 links correctly.

I anonymized the paths, so ignore the '...'

install electron-windows-notifications error

npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm ERR! code 1
npm ERR! path D:\fpsmember\node_modules@nodert-win10-au\windows.foundation
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
npm ERR! _nodert_generated.cpp
npm ERR! d:\fpsmember\node_modules@nodert-win10-au\windows.foundation_nodert_generated.cpp : fatal error C1107: could not find assembly 'platform.winmd': please specify the assembly search path using /AI or by setting the LIBPATH environment variable [D:\fpsmember\node_modules@nodert-win10-au\windows.foundation\build\binding.vcxproj]
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.8.3 found at "C:\Python38\python.exe"
npm ERR! gyp info find VS using VS2017 (15.9.28307.1177) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Python38\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'C:\Users\boy15\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'msvs',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'D:\fpsmember\node_modules\@nodert-win10-au\windows.foundation\build\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'D:\fpsmember\node_modules\@nodert-win10-au\windows.foundation\common.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\Users\boy15\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\Users\boy15\AppData\Local\node-gyp\Cache\14.17.0\include\node\common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=C:\Users\boy15\AppData\Local\node-gyp\Cache\14.17.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\Users\boy15\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\Users\\boy15\\AppData\\Local\\node-gyp\\Cache\\14.17.0\\<(target_arch)\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=D:\fpsmember\node_modules\@nodert-win10-au\windows.foundation',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'D:\fpsmember\node_modules\@nodert-win10-au\windows.foundation\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'build/binding.sln',
npm ERR! gyp info spawn args '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args '/nologo',
npm ERR! gyp info spawn args '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onExit (C:\Users\boy15\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:376:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! gyp ERR! command "P:\nodejs\node.exe" "C:\Users\boy15\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\fpsmember\node_modules@nodert-win10-au\windows.foundation
npm ERR! gyp ERR! node -v v14.17.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\boy15\AppData\Local\npm-cache_logs\2021-06-12T14_41_46_318Z-debug.log

does not allow me to run npm install

G:\Github_Downloads\electron-windows-notifications\node_modules@nodert-win10-au\windows.applicationmodel>if not defined npm_config_node_gyp (node "C:\Users\kumarpr\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\kumarpr\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
_nodert_generated.cpp
NodeRtUtils.cpp
OpaqueWrapper.cpp
CollectionsConverterUtils.cpp
g:\github_downloads\electron-windows-notifications\node_modules@nodert-win10-au\windows.applicationmodel_nodert_generated.cpp : fatal error C1107: could not fi
nd assembly 'platform.winmd': please specify the assembly search path using /AI or by setting the LIBPATH environment variable [G:\Github_Downloads\electron-wind
ows-notifications\node_modules@nodert-win10-au\windows.applicationmodel\build\binding.vcxproj]
g:\github_downloads\electron-windows-notifications\node_modules@nodert-win10-au\windows.applicationmodel\nodertutils.cpp : fatal error C1107: could not find ass
embly 'platform.winmd': please specify the assembly search path using /AI or by setting the LIBPATH environment variable [G:\Github_Downloads\electron-windows-no
tifications\node_modules@nodert-win10-au\windows.applicationmodel\build\binding.vcxproj]
g:\github_downloads\electron-windows-notifications\node_modules@nodert-win10-au\windows.applicationmodel\opaquewrapper.cpp : fatal error C1107: could not find a
ssembly 'platform.winmd': please specify the assembly search path using /AI or by setting the LIBPATH environment variable [G:\Github_Downloads\electron-windows-
notifications\node_modules@nodert-win10-au\windows.applicationmodel\build\binding.vcxproj]
g:\github_downloads\electron-windows-notifications\node_modules@nodert-win10-au\windows.applicationmodel\collectionsconverterutils.cpp : fatal error C1107: coul
d not find assembly 'platform.winmd': please specify the assembly search path using /AI or by setting the LIBPATH environment variable [G:\Github_Downloads\elect
ron-windows-notifications\node_modules@nodert-win10-au\windows.applicationmodel\build\binding.vcxproj]
win_delay_load_hook.cc
c:\users\kumarpr\appdata\roaming\npm\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc : fatal error C1107: could not find assembly 'platform.win
md': please specify the assembly search path using /AI or by setting the LIBPATH environment variable [G:\Github_Downloads\electron-windows-notifications\node_mo
dules@nodert-win10-au\windows.applicationmodel\build\binding.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\kumarpr\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\kumarpr\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd G:\Github_Downloads\electron-windows-notifications\node_modules@nodert-win10-au\windows.applicationmodel
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE

uncaughtException: The specified module could not be found.

I am facing the below exception when I try to load the electron-windows-notification module only on a few machines(a windows laptop and a windows 10 VM). Works fine on the rest of the machines. I are using electron-builder to build the app.

Error stack:

uncaughtException: The specified module could not be found.
\?\C:\Users\IEUser\AppData\Local\Temp\49aaf4c2-8efb-4642-9d5d-b9cde8c781ac.tmp.node
Error: The specified module could not be found.
\?\C:\Users\IEUser\AppData\Local\Temp\49aaf4c2-8efb-4642-9d5d-b9cde8c781ac.tmp.node
at process.func (electron/js2c/asar.js:140:31)
at process.func [as dlopen] (electron/js2c/asar.js:140:31)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:922:18)
at Object.func (electron/js2c/asar.js:140:31)
at Object.func [as .node] (electron/js2c/asar.js:149:18)
at Module.load (internal/modules/cjs/loader.js:735:32)
at Module._load (internal/modules/cjs/loader.js:648:12)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:775:19)
at require (internal/modules/cjs/helpers.js:68:18)
at Object. (C:\Program Files (x86)\iTutor2\dist\browser\resources\app.asar\node_modules@nodert-win10-au\windows.ui.notifications\lib\main.js:25:20)
at Module._compile (internal/modules/cjs/loader.js:880:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:892:10)
at Module.load (internal/modules/cjs/loader.js:735:32)
at Module._load (internal/modules/cjs/loader.js:648:12)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:775:19)
at require (internal/modules/cjs/helpers.js:68:18)
at Object. (C:\Program Files (x86)\iTutor2\dist\browser\resources\app.asar\node_modules\electron-windows-notifications\src\index.js:33:27)
at Module._compile (internal/modules/cjs/loader.js:880:30)

I have tried the below solutions to fix the issue, but none of them have worked.

  1. Used dependency walker on the .tmp.node module and copied few missing dlls (vcruntime140.dll, vccorlib140.dll, msvcp140.dll) from system32 directory to the root directory of the app.

  2. Unpacked the module from asar

@nodert-win10-au\windows.ui.notifications\build\Release\binding.node is not a valid Win32 application.

@nodert-win10-au\windows.ui.notifications\build\Release\binding.node is not a valid Win32 application.

@nodert-win10-au\windows.ui.notifications\build\Release\binding.node
    at process.func (electron/js2c/asar.js:140)
    at process.func [as dlopen] (electron/js2c/asar.js:140)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:922)
    at Object.func (electron/js2c/asar.js:140)
    at Object.func [as .node] (electron/js2c/asar.js:140)
    at Module.load (internal/modules/cjs/loader.js:735)
    at Module._load (internal/modules/cjs/loader.js:648)
    at Module._load (electron/js2c/asar.js:717)
    at Function.Module._load (electron/js2c/asar.js:717)
    at Module.require (internal/modules/cjs/loader.js:775)

Can not install package

gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\Abyss Watcher\AppData\Local\Programs\Python\Python37-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:970:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Abyss Watcher\source\repos\TheWatcher\TheWatcher\node_modules\@nodert-win10-cu\windows.applicationmodel
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @nodert-win10-cu/[email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @nodert-win10-cu/[email protected] 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!     C:\Users\Abyss Watcher\AppData\Roaming\npm-cache\_logs\2019-03-17T18_02_55_302Z-debug.log

node-gyp rebuild failure

> node-gyp rebuild


E:\workspace\LearnProject\electronjs\electron-study-1\node_modules\@nodert-win10-au\windows.applicationmodel>if not defined npm_config_node_gyp (node "D:\Program File\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "D:\Program File\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“-m”开关。
  _nodert_generated.cpp
  NodeRtUtils.cpp
  OpaqueWrapper.cpp
  CollectionsConverterUtils.cpp
  win_delay_load_hook.cc
E:\workspace\LearnProject\electronjs\electron-study-1\node_modules\@nodert-win10-au\windows.applicationmodel\_nodert_ge
nerated.cpp : fatal error C1107: 未能找到程序集“platform.winmd”: 请使用 /AI 或通过设置 LIBPATH 环境变量指定程序集搜索 路径 [E:\workspace\LearnProjec
t\electronjs\electron-study-1\node_modules\@nodert-win10-au\windows.applicationmodel\build\binding.vcxproj]
E:\workspace\LearnProject\electronjs\electron-study-1\node_modules\@nodert-win10-au\windows.applicationmodel\Collection
sConverterUtils.cpp : fatal error C1107: 未能找到程序集“platform.winmd”: 请使用 /AI 或通过设置 LIBPATH 环境变量指定程 序集搜索路径 [E:\workspace\Lea
rnProject\electronjs\electron-study-1\node_modules\@nodert-win10-au\windows.applicationmodel\build\binding.vcxproj]
D:\Program File\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc : fatal error C1107: 未能找到程序集“p
latform.winmd”: 请使用 /AI 或通过设置 LIBPATH 环境变量指定程序集搜索路径 [E:\workspace\LearnProject\electronjs\electron-study-1\node_modules
\@nodert-win10-au\windows.applicationmodel\build\binding.vcxproj]
E:\workspace\LearnProject\electronjs\electron-study-1\node_modules\@nodert-win10-au\windows.applicationmodel\NodeRtUtil
s.cpp : fatal error C1107: 未能找到程序集“platform.winmd”: 请使用 /AI 或通过设置 LIBPATH 环境变量指定程序集搜索路径 [E:\workspace\LearnProject\elec
tronjs\electron-study-1\node_modules\@nodert-win10-au\windows.applicationmodel\build\binding.vcxproj]
E:\workspace\LearnProject\electronjs\electron-study-1\node_modules\@nodert-win10-au\windows.applicationmodel\OpaqueWrap
per.cpp : fatal error C1107: 未能找到程序集“platform.winmd”: 请使用 /AI 或通过设置 LIBPATH 环境变量指定程序集搜索路径 [E:\workspace\LearnProject\el
ectronjs\electron-study-1\node_modules\@nodert-win10-au\windows.applicationmodel\build\binding.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `D:\Program Files (x86)\Microsoft\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\Program File\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Windows_NT 10.0.19042
gyp ERR! command "D:\\Program File\\nodejs\\node.exe" "D:\\Program File\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\workspace\LearnProject\electronjs\electron-study-1\node_modules\@nodert-win10-au\windows.applicationmodel
gyp ERR! node -v v14.16.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\electron-installer-redhat):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin,linux","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\electron-installer-flatpak):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin,linux","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\appdmg):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\macos-alias):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fs-xattr):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"!win32","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\electron-installer-debian):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin,linux","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @nodert-win10-au/[email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @nodert-win10-au/[email protected] 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!     D:\AppData\Data\npm\node_cache\_logs\2021-04-08T02_44_00_615Z-debug.log

Close notifications manually

Hi!
Currently ToastNotifications are displayed for ~6 seconds and then disappear (windows 10). I tried to set expirationTime, but it affects only notification inside action center. Is there a chance to set a timer or display notification till it will be closed manually by clicking or calling notification.hide()?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.