Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use with commonjs #5

Closed
si458 opened this issue Jul 19, 2021 · 6 comments
Closed

how to use with commonjs #5

si458 opened this issue Jul 19, 2021 · 6 comments

Comments

@si458
Copy link

si458 commented Jul 19, 2021

Hi All,
how do i use this with commonjs - node 16.5.0 ?
const { NotifyIcon, Icon, Menu } = require("not-the-systray"); just screams
Error: Cannot find module './notify_icon.node'
i installed it via npm install not-the-systray
it doesnt to have seem to of build the .node module thats required?

@si458
Copy link
Author

si458 commented Jul 19, 2021

ok i think i got it, long winded but works!

  1. install python2.7 x64
  2. download zip, extract to your base folder and cd into it
  3. install packages in folder npm install
  4. configure gyp to target your node version .\node_modules\.bin\node-gyp configure --target=16.5.0
  5. build the module with your node version npm run build --target=16.5.0
  6. clean the project or stuff not needed npm run clean
  7. delete extra folders del test del src del node_modules
  8. then include it in your package directly const { NotifyIcon, Icon, Menu } = require("./node-not-the-systray");

@simonbuchan
Copy link
Owner

Weird, it's definitely in the package: https://unpkg.com/browse/not-the-systray@0.3.1/

My best guess is that you're using a 32-bit node somehow?

@si458
Copy link
Author

si458 commented Jul 19, 2021

Weird, it's definitely in the package: https://unpkg.com/browse/not-the-systray@0.3.1/

My best guess is that you're using a 32-bit node somehow?

Nope I'm defo 100% using 64bit
It's weird because the npm install only downloads like 4 files? No .node bundle file and doesn't even try to build it so I have to build it manually

@simonbuchan
Copy link
Owner

It won't with source checkouts, you need to manually npm run build, but it automatically does before publishing to npm. The whole point is that you don't need all those dependencies...

What's the exact error message? Does the package.json in the downloaded package have version 0.3.1?

If you run npm install not-the-systray in a completely fresh directory what's the content of node_modules\not-the-systray? Does npm unlink not-the-systray or npm cache clean before that make any difference?

@si458
Copy link
Author

si458 commented Jul 20, 2021

now thats weird, a fresh folder this morning, and now it has the notify_icon.node file included?
but in yesterdays fresh folder notify_icon.node was missing?
i only ran npm install not-the-systray nothing else? but is this because i have previously build it manually maybe?

EDIT:
even weirder, went back to my original project im working on
npm remove not-the-systray; npm unlink not-the-systray; npm cache clean --force; npm install not-the-systray
and the notify_icon.node file is in the folder, wtf!?
maybe npm was having one of those days?

EDIT, EDIT:
ill close this issue as its now working, but ive left helpful step by step above for anyone wanting to build manually tho

@si458 si458 closed this as completed Jul 20, 2021
@simonbuchan
Copy link
Owner

Weird. It could be a badly cached package (the .node file would be most of the size), or a virus scanner being too aggressive or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants