jolocom / jolocom-lib

Library for interacting with the identity solution provided by Jolocom.
MIT License
24 stars 18 forks source link

Module not found: Can't resolve 'jolocom-lib/js/didMethods/utils' #451

Closed VMLVaske closed 3 years ago

VMLVaske commented 3 years ago

Description

Hi y'all!

I need some help setting up my developing-environment with jolocom-lib.
Tried following the docs under https://jolocom-lib.readthedocs.io/en/latest/gettingStarted.html

Ran "npm install jolocom-lib" which installed jolocom-lib v.5. Then I read in issue #431 that version 4.4.1 is needed. Changed the version number in my package.json, re-ran "npm install". Upon "npm start" apparently a module is missing:

Module not found: Can't resolve 'jolocom-lib/js/didMethods/utils'

What am I doing wrong?

mnzaki commented 3 years ago

Hello @VMLVaske! Could you please provide more info about which code snippet is failing? Also which version of node are you on? Are there any errors during npm install jolocom-lib? The error you are getting looks rather strange, can you double check that you have the right version of jolocom-lib? Perhaps try to delete your node_modules and reinstall everything

VMLVaske commented 3 years ago

Hi @mnzaki

Thank you for replying! I delete my node_modules folder and ran npm install again. No errors during this.

Ran npm start again but Failed to compile - Module not found: Can't resolve @jolocom/native-core' Then did npm install @jolcom/native-core, some warning but no errors. Npm start failed to compile again, module @jolocom/vaulted-key-provider not found. Installed that manually with npm i @jolocom/vaulted-key-provider

npm start again, this time Failed to compile - Module not found: Can't resolve jolocom-lib/js/didMethods/utils'. :/

A friend replicated the error yesterday on his machine

My npm version is 6.14.3, my node version is v10.19.0

Do you have any other ideas on what I could try?

VMLVaske commented 3 years ago

Oh, and the code snippet:

`import React, {Component} from 'react'; import { walletUtils } from '@jolocom/native-core' import { SoftwareKeyProvider } from '@jolocom/vaulted-key-provider' import { createIdentityFromKeyProvider } from 'jolocom-lib/js/didMethods/utils' import { JolocomLib } from 'jolocom-lib'

import { Button } from '@material-ui/core'

const password = 'secretpassword'

const didJolo = JolocomLib.didMethods.jolo

SoftwareKeyProvider.newEmptyWallet(walletUtils, 'id:', password).then(emptyWallet => { console.log(emptyWallet) })

createIdentityFromKeyProvider( emptyWallet, password, didJolo.registrar ).then(identityWallet => { console.log(identityWallet.did) })

class CreateSSI extends Component {

render() { return (

)

} }

export default CreateSSI; `

Looking at this, it seems the import { createIdentityFromKeyProvider } from 'jolocom-lib/js/didMethods/utils' is to blame? But this was taken directly from the docs

mnzaki commented 3 years ago

Ah it seems you're doing something more complicated with npm start, I thought you were running the code snippets directly :smile: I see React imports, is this meant for react-native or for the web? React Native requires a bit more setup. As for web browsers, we don't support that yet unfortunately

VMLVaske commented 3 years ago

oh! That's important to know :D it was intended as a react web application, to get to know the jolocom-sdk and -lib for future projects. Do you maybe have a recommendation how I would best proceed in getting to work with your libraries, or is switching to react native the path of least resistance?

Anyhow, thanks for the support! It seems like we found out the cause of this issue!

mnzaki commented 3 years ago

You can still create a web application, but the jolocom-sdk would be used on the backend instead. We have a demo (with a React frontend actually!) here: https://github.com/jolocom/interactions-demo Incidentally there's an issue with the current version https://github.com/jolocom/interactions-demo/issues/18 and I'm actively working on it

VMLVaske commented 3 years ago

Thank you! I will check that out :)