简体   繁体   中英

E212: Error Cannot open file for writing (VIM - .startup extension)

I have look through various responses to similar questions but none of the solutions have helped me.

I am getting the error:

"/pc1.startup" E212: Cannot open file for writing

I understand you cannot open a .startup file in notepad and edit it then save it as the .startup extension but I am struggling with finding a way to write the changes to my hard drive. Nano also gives me the same issue. If anyone knows any solutions that would be appreciated.

I would guess that "various responses" have brought these up already, but for lack of detail I can only state the obvious:

Editors (mostly) don't care for file extensions, but the location matters a lot. As you're attempting to write to the root directory ( / ), you need to be root to be allowed to write there.

As I don't understand why a *.startup file needs to be there, it would be best to store it elsewhere. In Vim, you can do this via :saveas ~/pc1.startup (choosing your home directory instead). If it needs to be there, launch Vim as the root user with sudo vim /pc1.startup instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM