Testers wanted for boilerplate to create CLI apps (Mac, Windows, Linux)

Thank you so much! This is great, will be checking it out soon.

1 Like

Then I cd to the CLI folder and run npm install

which fails with…
ffi_bindings.target.mk:104: recipe for target ‘Release/obj.target/ffi_bindings/src/ffi.o’ failed
make: *** [Release/obj.target/ffi_bindings/src/ffi.o] Error 1
make: Leaving directory ‘/home/willie/projects/safe/safe-cli-boilerplate/node_modules/ffi/build’
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:180:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Linux 4.15.0-23-generic
gyp ERR! command “/usr/bin/node” “/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
gyp ERR! cwd /home/willie/projects/safe/safe-cli-boilerplate/node_modules/ffi
gyp ERR! node -v v9.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ffi@2.2.0 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ffi@2.2.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/willie/.npm/_logs/2018-06-04T23_50_05_210Z-debug.log

Let me know if you need the complete log

This is beyond me, but can you try:

rm -rf node_modules
npm install

Ah, also:

python --version

clearing node_modules and reinstalling took me no further forward

willie@sputnik:~/projects/safe/safe-cli-boilerplate$ python --version
Python 2.7.15rc1

Should I have Python 3?

No, python 2 is good.

So I’m stumped, maybe @DGeddes can get somebody to look at those errors because they appear to be related to the Maidsafe libs.

2 Likes

What versions of NPM and NodeJS are you using? I believe MaidSafe requires Node version 8.

$ node --version
# e.g. v8.11.1

$ npm --version
# e.g. 5.6.0
willie@sputnik:~/projects/safe$ ./safedevreporter.sh 

SAFE dev tools version report

What is the value of $NODE_ENV set to?
NODE_ENV =

NPM version
6.1.0

node version
v9.11.1

Rust version
rustc 1.25.0 (84203cac6 2018-03-25)

Cargo version
cargo 0.26.0 (41480f5cc 2018-02-26)
release: 0.26.0
commit-hash: 41480f5cc50863600e05aa17d13264c88070436a
commit-date: 2018-02-26

general system status
Linux sputnik 4.15.0-23-generic #25-Ubuntu SMP Wed May 23 18:02:16 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

willie@sputnik:~/projects/safe$

I’ll 'av a word…

David.

1 Like

Working nicely on Windows without a glitch.

Peruse: head of Dev branch, packaged
Nodejs: 8.9.4
Yarn: 1.3.2

Simple steps:

  • clone https://github.com/theWebalyst/safe-cli-boilerplate.git
  • NODE_ENV=dev permanently set on system
  • yarn
  • yarn build-mock
  • Start Peruse, login
  • Execute ./dist/mock/safecmd.exe, Peruse authorisation requests pops up, I approve, and terminal receives auth URI.

This is great. Love it.

@southside I’ll spin up a Linux VM and see if I can get it to break.
Be sure to export NODE_ENV=dev.
Are you using nvm to manage NodeJS versions?
Install 8.9.4, or just nvm install 8 to have it choose the latest of 8.x.x.

[UPDATE]
Success on Ubuntu Linux with the same steps and same versions.

I was however able to break the install process by trying with NodeJS 9.x.x

5 Likes

Thanks @hunterlester, this is great :slight_smile:

Please can you try running the resulting command several times in succession, and check if the second part of the console output (the interaction with SAFE) is always there or sometimes missing.

1 Like

Thank you @bzee for helping build this (folks, this contains @bzee’s code and is at least as much his creation as mine).

Thank you @bzee @davidpbrown @southside @draw and @hunterlester for testing. It’s really useful to pick up these issues and fix then so quickly because of your help.

I think this is going to be quite a useful addition and am excited to see what people do with it. I also have a plan for it of course :slight_smile:

And there are several improvements we could make. What would be really useful is a separate Authenticator library so that this and other projects could auth without the browser (by using stored credentials, this would allow ‘headless’ SAFE apps). I have no plans to do that myself though.

2 Likes

Announced on the main forum:

3 Likes

Most useful would be the simplest example app - one that can download a file that exists on the network.

This example looks complicated by requiring writeable authorisation and then creating mutable data in the user’s account.

I’d love to see the form of the most trivial app, which

  1. perhaps necessarily safeApp.bootstrap
  2. download a file known to exist, for example safe://hello/index.html

Then ambitions for bug fixing more complexity would become simpler.

tldr; Can the CLI do what the browser can do?

2 Likes

To do this you’d need to create a public name, service and so on which complicate things and go further. The intention here is just to demonstrate it can access the SAFE API. Going further makes assumptions about what someone wants to do, and on the live network (eventually) I don’t think creating a random public ID on somebody’s account would be a good idea.

So on balance, I don’t this is a role for the boilerplate. I think somebody could though create a trivial example app from it, such as to create a public ID and simple website, or file upload and download. I think that’s a good idea and hopefully somebody will see that as a nice little project. For now though I am going to try and use it for real.

Thanks for the feedback and suggestion. I will keep it in mind.

1 Like

On the mock perhaps… but on prod, exactly the opposite.
safe://hello/index.html exists… challenge is to fetch it.

Another option would be to provide a tutorial which shows how to do this with SAFE CLI Boilerplate. It’s not a priority for me though - I took time out to put the boilerplate out there for others but am now getting back to why I made this. So feel free if it appeals to you.

Easier said that done; I would if I could; etc.

1 Like

Yaaay - got it working :grin:

Problem was my node version was too new. 9.11.1

nvm install 8
nvm use 8

and it all just worked…

Thanks @happybeing

2 Likes
Quick Setup Completed
New file is created and saved to the network successfully
The file has been opened and read
The content of the file which has been read: Hello Safe World

That went flawlessly on fedora 28 with node v8.11.2 and npm 5.6.0.
On to the next steps.

2 Likes

@nice & @southside thank you for checking this out and reporting back :slight_smile:.

If you have time, please can you both run the compiled command about five or so times to see if the output (quoted here by @nice) is sometimes missing.

If you do this please post results here along with your operating system and if known, OS version.

1 Like