SAFE Drive - help with testing

Bah - not my day :roll_eyes:

user@user1:~/safe-fuse-test/safenetwork-fuse$ node bin.js
module.js:550
    throw err;
    ^

Error: Cannot find module 'debug'

John, you are doing valuable work. These look like bugs too - so thatā€™s actually a win :wink:

It shows I donā€™t understand it all and/or donā€™t have time to test all the ways I can mess up. So, again: thank you.

Two things to try, first:

DEBUG=safenetworkjs*,safe-fuse* node bin

Iā€™m curious to know if I donā€™t see that because I always run with DEBUG, although again it looks to me like the npm install was without NODE_ENV=dev though I know you said you definitely did that.

It would still be a bug though so Iā€™m off to look at the package.json

Anyway, a quick fix might be to then try: npm install debug

2 Likes
user@user1:~/safe-fuse-test/safenetwork-fuse$ DEBUG=safenetworkjs*,safe-fuse* node bin
module.js:550
    throw err;
    ^

Error: Cannot find module 'debug'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/user/safe-fuse-test/safenetwork-fuse/bin.js:3:15)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
2 Likes

Yep, thereā€™s a bug in the safenetworkjs/package.json so high five man :grinning:

So in safenetworkjs, you need to do:

npm install --save debug
2 Likes
user@user1:~/safe-fuse-test/safenetworkjs$ npm install --save debug
+ debug@4.1.0
added 16 packages from 3 contributors, updated 2 packages and audited 331 packages in 2.063s
found 1 high severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

Yeh, thatā€™s not one of ours as we say in the trade :wink:

Thanks for reporting it though. Nothing I can do for now.

2 Likes

No worries. Think Iā€™ll take the lazy option and wait for the zip package!

2 Likes

By all means, although I think youā€™re probably there now. At least run it! :laughing:

That last scarey message is only a warning. The code works regardless.

1 Like

OK I tried node bin.js and got the same error - do you reckon itā€™s worth starting again from scratch? Iā€™ll try the build process again with the extra steps.

I donā€™t understand why it is complaining about debug if you have just installed it. You could check that the following directories exist:

safenetworkjs/node_modules/debug
safenetwork-fuse/node_modules/debug

I not, then try npm install --save debug in the corresponding project directory and check again.

1 Like

Iā€™m going to cook dinner now so may not be responsive. Sorry this isnā€™t going as smoothly as Iā€™d expect. Iā€™ll have to walk through the README.md instructions again.

Yeah they exist OK. Ooo run build-mock seems to be working now. Also off for my dinner!

1 Like

They exist and you still get this error running node bin ?

Aha - node bin rather than node bin.js works. Peruse has now popped up but itā€™s the live rather than the mock version and the safe drive doesnā€™t seem to have mounted. Iā€™m going to run through it all again

Iā€™m in! Live version again, I canā€™t get mock to work. Worth noting that ./mount-safe needs to be run from the safenetwork-fuse/dist/prod folder.

Pretty sure thereā€™s no difference there, so it will be something else.

Cool, so did you build?

node bin runs the code before build. ./mount-safe runs the built version.

Anyway, good to see you have something to play with. :slight_smile:

No, the build failed again. Lots of warnings then it gave up. However, node bin started Peruse and ./mount-safe mounted the drive. It seems pretty much the same as before though (copying a small file into _public causes everything to hang). I did manage to mkdir though. Is that new?

Iā€™m a bit confused as to whatā€™s happening here. If you have a ./safe-fuse, you must have built it. I havenā€™t tested the build though, so donā€™t know what works or not when built, but yes mkdir is a new feature. Also try the speedup with the File Manager.

When you do node bin that is the same as running safe-fuse so it is one or the other that mounts the SAFE drive. The first is running the code - unbuilt - the second runs the same code in built form.

So I suggest you just try node bin and if that mounts the drive, play with that and forget about building and mount-safe.

1 Like

You can only copy to a path that already has files uploaded by WHM. So copying into _public itself wonā€™t work, but copying a file next to where you already have at least one file, say index.html should work.

This is all useful by the way, itā€™s also helping me think about the UX. I was thinking that copying a file to a new directory in _public could trigger creation of a new container for the file, if that makes any sense? Iā€™d be interested to hear what you think.

node bin starts Peruse but doesnā€™t mount the safe-drive.

Yes, sorry. I think the build did work. The first time I tried ./mount-safe nothing happened so I tried node bin and then ./mount-safe and that at least did something. However I just did the build again and retried (just in case, so as not to look a fool) and this time the Peruse opened. Right, onwards!

BTW a good tip if it hangs is fusermount -uz ~/SAFE

EDIT: not really working for me Iā€™m afraid. ./mount-safe starts Peruse but doesnā€™t mount the safe drive. Running it again from a separate terminal mounts the drive but even trying to copy a tiny file via the command line into a pre-existing public folder with files in causes it to hang.

1 Like