Reputation: 5386
I've installed successfully chef on my workstation but when i am trying to create a role using the following command
knife role create startmeup
I get
ERROR: RuntimeError: Please set EDITOR environment variable
Any idea what the problem is?
Upvotes: 35
Views: 49506
Reputation: 23
Knife prioritizes knife.rb over the environment variable.
It seems knife will default to vim (on my system, anyway) if no config is provided, so it is safe to omit the value until you're ready to configure your environment for a custom editor (in my case, a script).
Upvotes: 0
Reputation: 151
If you have notepad++ installed in your machine :
knife environment create startmeup -e notepad++
Upvotes: 0
Reputation: 193
There're a few ways to deal with the problem.
set the environment variable $EDITOR. You can export it by export EDITOR=vim
in shell, or put this line in files like .bashrc;
pass the option -e vim
(namely --editor vim
)to the knife
command. For example, you can do it like this:
knife role create startmeup -e vim
modify ~/.chef/knife.rb by add this line:
knife[:editor] = "vim"
Upvotes: 4
Reputation: 2753
In your knife.rb file (~/.chef/knife.rb) add the following line for notepad++ :
knife[:editor] = "C:\\progra~2\\notepa~1\\notepad++.exe -nosession -multiInst"
or if you just want to use notepad
knife[:editor] = "notepad"
or emacs for GNU
knife[:editor] = "emacs"
Upvotes: 28
Reputation: 179
There is no explicit way to set the variable under knife.rb. Its good to export on your shell using $export EDITOR=vim (or any of those that you would like to keep).
Even without setting variable under knife.rf it works. Just export the EDITOR by setting the appropriate value.
Upvotes: -2
Reputation: 31
If you want to set it for that session, the command
set EDITOR="C:\Program Files (x86)\Notepad++\notepad++.exe"
works.
Upvotes: 3
Reputation: 5386
Adding this entry to the knife config file worked for me
knife[:editor] = "Notepad"
Upvotes: 0
Reputation: 9
export EDITOR=vi
In my case it worked.but for ubuntu14.o version vi editor backspace is not working.
Upvotes: 0
Reputation: 746
Just set your editor and it will work. In my case I use vim editor that's why my command was as follows:
export EDITOR=vim
Upvotes: 2
Reputation: 37600
You have to define EDITOR
as environment variable.
Try
export EDITOR=$(which vi)
To persist this, add it to ~/.bashrc
or ~/.bash_profile
.
Upvotes: 46