CLI NRS create Question


Just been messing about trying to see if I could get stuff on the shared section, and came across a hitch trying to create an NRS name:

Typed in the following:

nrs create mynewsite --link “safe://hnyynywwur9yaznjf48w8med8xspjdp8bogqspdh7z19ppz3emtpm5wryhbnc?v=0”

And got this back:

[Error] InvalidInput - The linked content (NrsMapContainer) is versionable, therefore NRS requires the link to specify a version: "“safe://hnyynywwur9yaznjf48w8med8xspjdp8bogqspdh7z19ppz3emtpm5wryhbnc?v=0"”

Any ideas what I’m doing wrong?

Also, you’ll notice the original command is missing the ‘safe.’

The only way I seem to be able to get CLI working is by clicking on exe file, which opens a terminal where all the commands seem to work, if I miss off the ‘safe.’ ie. I can’t work from a terminal opened in any other way.

Thanks in advance!


Just a thought. Maybe someone has already used mynewsite - try calling it something else.

You’re using Windows I take it?

1 Like

The CLI has an interactive mode which you enter when you invoke the executable without any arguments, within the interactive mode you can use the exact same commands and arguments but without providing the name of the binary, i.e. safe.

That seems correct to me, I’m not able to connect to the shared section at this moment so cannot check exactly, but can you please confirm you can run a cat and a dog on that same URL?
Also, which version of CLI are you using?


@david-beinn I was able to reproduce the issue, for some reason the enclosing " are being the problem in the interactive mode (this is a bug, if you can please report it on GitHub it will be very helpfull).

So for now you have two options:

  • you can use the CLI from the console ( and run safe nrs create mynewsite --link “safe://hnyynywwur9yaznjf48w8med8xspjdp8bogqspdh7z19ppz3emtpm5wryhbnc?v=0” (you see the " are still there and that should work fine)
  • or you can use the interactive mode, as you are doing, but make sure you don’t enclose the URL with ", i.e. run nrs create mynewsite --link safe://hnyynywwur9yaznjf48w8med8xspjdp8bogqspdh7z19ppz3emtpm5wryhbnc?v=0, that also worked for me.


catting that address gives me this…

and it looks nice too :slight_smile:

PS guess who just got awarded a freebie 3-month sub to CodeAcademy :slight_smile:

EDIT: looking forward to seeing this develop


Thanks all for the replies. Sorry just posted this and then went to bed!

@jpl That’s not what I actually put as the NRS address. I just changed it so people like Willie didn’t go noseying around at things that aren’t finished!

@southside Yeah, that’s what’s supposed to be there. Test front end de-coupled from any SAFE dependencies (previously was all set up for alpha 2 API, now connects to a list of details of some local businesses in Ayr!) Not done any responsive work on it yet though, so currently optimised for iphone 5 only! I’ll post the tidied up version later in the week hopefully…

Thanks @bochaco. My internet’s been a bit funny this morning but I’ll give it another try and let you know how I get on.


Got the second of these methods working, thanks very much Gabriel!

I’m reasonably familiar with using the console for moving between directories, installing npm stuff etc. but I think I must be doing something wrong, or something’s gone funny with the install (I’m on mac High Sierra.)
I’m working from users/ and just trying the commands as they work in the interactive shell, but with safe before them eg. safe nrs create…
I get the response:
bash: safe: command not found

(I also tried from /.safe and /.safe/cli)

When I first installed I got the message from the installer:

echo “=> Shell profile not found. Tried {tried_profile-}~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile" echo "=> Create one of them and run this script again" echo " OR" echo "=> Append the following lines to the correct file yourself:" command printf "{safe_cli_in_path_str}”

But then I tried again and the message didn’t pop up, and I checked and there is a .bashrc file in users/ with the following code in it:

source /Users/david/.bash_safe_cli
source /Users/david/.bash_safe_cli

export PATH=$PATH:/Users/david/.safe/cli

No worries if nothing obvious pops up as the problem, happy enough using the interactive shell for now.

I’ll go over and log the “” problem in github…

Thanks again.

It seems CLI is not being set in your system’s PATH. Do you mean even trying to run $ ~/.safe/cli/safe --help doesn’t work?

If that works, then it’s just the path not set as I said, we are aware of an issue with Mac and zsh, we’ll need some Mac users to help you set it in the PATH correctly

1 Like


Works just as you wrote it above:

~/.safe/cli/safe --help (or networks etc etc.)

I’d only tried by actually cding into CLI, or going straight from user.

Bit long-winded to do that every time, but no real bother, especially if I can just use the interactive shell.

Sorry was a bit confusing in my last post I meant to write users/user each time, but had user in triangular brackets and markdown obviously just left it out!

Right, ok cool, well let’s see if some Mac user can tell us how to set the path on Mac so you can then use safe from the console, the two source /Users/david/.bash_safe_cli entries in your .bashrc file look suspicious to me unless you know what they are

This should also work, but you’ll have to use ./safe to invoke it from within ~/.safe/cli directory.

1 Like

Yep, that works thanks. I’ll maybe have a little play around deleting one or both of those entries and see if that fixes anything.

1 Like

Dunno if this works on a Mac but you could try
which safe

I find myself using this quite often to make sure I am actually using the version I think I am.

Also ls -l which safe to get date and file size cos safe -V is not always precise enough if you have built locally.

surrounded by backticks ( left of “1”) Discourse uses bacticks to show formatted code so its hard to display them right on here

‘which safe’ will only work if ‘safe’ works (assuming Mac has it)

Fyi $(which safe) is a handy alternative.

1 Like