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

NodeJS require #133

Open
dawidpstrak opened this issue May 5, 2020 · 6 comments
Open

NodeJS require #133

dawidpstrak opened this issue May 5, 2020 · 6 comments

Comments

@dawidpstrak
Copy link

HI. Is it possible to import library by
const library = require('library') ?

@Solant
Copy link
Contributor

Solant commented May 5, 2020

Sure, just like in any other nodejs or webpack app

@dawidpstrak
Copy link
Author

But i got this error when i try
https://pasteboard.co/J70Fp6y.png

@Solant
Copy link
Contributor

Solant commented May 5, 2020

you should run 2 npm scripts at the same time:
npm run start starts actual qode instance, while npm run dev starts webpack bundle for your js code

so you need to run both start and dev

UPD: both scripts should be running, if you need to restart app, you can just restart only npm run start task

@dawidpstrak
Copy link
Author

dawidpstrak commented May 5, 2020

Yes i have started both. Dev server is working but shown error :
https://pasteboard.co/J70SV3F.png
and when i try npm run start it cant start
https://pasteboard.co/J70TCJr.png

It only happens when i ve my import lines in code

const memoryjs = require('memoryjs')
const processes = memoryjs.get.processes()
console.log(processes)

When i remove these lines app render without problems.
It's not memoryjs issue because i dont have problem to require it in normal js file and run it with node filename.js

@Solant
Copy link
Contributor

Solant commented May 5, 2020

oh, I see now
memoryjs has some native code that is prebuilt for specific nodejs version
some additional steps may be required in this case, https://docs.nodegui.org/docs/guides/using-native-node-modules

or you can try different lib without prebuilt native binaries

@dawidpstrak
Copy link
Author

Ok cant setup it. Anyway thanks help.

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