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

import function not working #44

Open
wiulma opened this issue Feb 23, 2020 · 2 comments
Open

import function not working #44

wiulma opened this issue Feb 23, 2020 · 2 comments

Comments

@wiulma
Copy link

wiulma commented Feb 23, 2020

Hi!
I'm using your code, but I get this error

import {machineIdSync} from 'node-machine-id';

        ^^^^^^^^^^^^^
SyntaxError: The requested module 'node-machine-id' does not provide an export named 'machineIdSync'

In order to make it working, I import the module and then use default object to call exported function:

import ClientUtility from 'node-machine-id';
...
ClientUtility.machineIdSync({original: true})

My environment is node 13, so I'm using modules.
Is it possibile to import without default, or this is the right way to use it?
Thanks!

@PaulKeefe
Copy link

I had to do the same thing.
const ClientUtility = require('node-machine-id');
let machId = ClientUtility.machineIdSync(true);

@ahm750
Copy link

ahm750 commented Jun 12, 2020

As @PaulKeefe mentioned, you have to use require('node-machine-id') instead of "import".

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

3 participants