Moltin sdk not being found

javascript

#1

I’m starting a new project in angular 6. When I try to import the moltin sdk I get errors. I ran npm install --save @moltin/sdk

You can see that I have imported moltin sdk because of my node modules folder on the left. Also, I’ll add the screenshot of the browser.

This probably something that I’m doing wrong on my side… But, I’ve never ran into this problem before.
I’m using node v 5.11.3 and npm v5.6.0.


#2

Hey @dontetrumble

Thank you for raising this.

I get the same issue as you when I run with angular @ 6.x but it works fine on 5.

Please give me some time to look into this for you :slight_smile:


#3

@notrab @dontetrumble I am using Angular 6+. You might have to declare moltin in your typings.d.ts like so

declare module '@moltin/sdk';

#4

typings.d.ts? I don’t have that file. Is it in the node modules for moltin? Do I have to create that file in my angular project? Can screenshot your typings.d.ts file? @joe


#5

It should be created when you generated your Angular app assuming you used the Angular CLI as recommended by the Angular team. Here is a screen shot of my typings.d.ts


#6

Yes, I did use the angular cli. But, don’t see it. I’m going to create a new project and see if that makes the file.


#7

I’ve look through the entire application and not seeing this typings file. If possible can you take another screenshot or tell me what folder it’s in? Below is the files that got created for me when I created a new project.


#8

@dontetrumble After further testing I actually belive you are using version 3.12.0 of the moltin SDK and this indeed does have issues. I would think that you can fix this by troubleshooting the error yourself with how moltin has been packaged but a more sustainable solution would be moltin to fix this @notrab can you clear some more light on this as we are now heavily integrated with you and not being able to take advantages of the SDK is a huge disadvantage to us.

@dontetrumble for temp fix install the sdk moltin/sdk@3.10.0 and you should have no compile issues :slight_smile:


#9

Hi @joe

I’m looking into this.

Does @moltin/sdk@3.11 work for you? The only thing that changed in 3.11 was support for Files.

3.12 came with updated rollup configuration but the output should be exactly the same.


#10

@notrab Just tested and I can confirm that @moltin/sdk@3.11 does work.


#11

Thanks @joe

I’m looking into this :+1:


#12

Hi @joe @dontetrumble

Can you confirm if the issue is resolved when inserting the below into your webpack config?

node: {
  fs: 'empty'
}

We’re working to remove the node-localstorage dependency which is causing this issue for 4.0 and allow you to provide node-localstorage as an additional adapter.


#13

@joe I have reverted the moltin package to 3.10.0 but still has the same error.
I also tried to get revert back to 3.11 and it didn’t work either.

and for @notrab I don’t see the webpack config file. I did a search through the entire project folder and nothing with words “webpack” was found.


#14

Hi @dontetrumble

Please see this issue https://github.com/moltin/js-sdk/issues/156#issuecomment-387654113

@joe following the same steps here, are you still running into the same issue?

Once node-localstorage is removed this issue should go away.


#15

@notrab
@dontetrumble
Ahhh yes I did forgot about that little hack. I guess that is the reason why it is working for me


#16

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.