如何修复错误代码 bin root/go/bin 不是有效标识符?

如何修复错误代码 bin root/go/bin 不是有效标识符?

尝试在我的笔记本电脑上安装 chainlink 我必须安装 go。这样做我认为我做错了什么,现在每次打开 ubuntu 终端时都会收到错误消息,其中内容如下:

-bash: export: `Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/myusername/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/myusername/AppData/Local/Programs/Microsoft': not a valid identifier
-bash: export: `Code/bin:/snap/bin:/usr/local/go/bin:/root/go/bin': not a valid identifier

运行命令后的输出

grep 'export.*Files/Docker/Docker/resources/bin:' ~/.bashrc ~/.bash_profile ~/.bash_login ~/.profile /etc/profile /etc/bash.bashrc
/root/.bashrc:export PATH=/bin:/root/.nvm/versions/node/v16.13.2/bin:/root/.cache/cloud-code/installer/google-cloud-sdk/bin:/root/.vscode-server/bin/d045a5eda657f4d7b676/bin/remote-cli:/root/.local/share/solana/install/active_release/bin:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/lonar/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/lonar/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin:/usr/local/go/bin:/root/go/bin
grep: /root/.bash_profile: No such file or directory
grep: /root/.bash_login: No such file or directory

有没有办法删除/删除这些或修复错误句号?

答案1

/root/.bashrc,行中有空格

export PATH=/bin:/root/.nvm/versions/node/v16.13.2/bin:/root/.cache/cloud-code/installer/google-cloud-sdk/bin:/root/.vscode-server/bin/d045a5eda657f4d7b676/bin/remote-cli:/root/.local/share/solana/install/active_release/bin:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/lonar/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/lonar/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin:/usr/local/go/bin:/root/go/bin

...:/mnt/c/Program Files/Docker......Programs/Microsoft VS Code/bin:....

如果没有引号,该行将在每个空格处拆分为单词,并export尝试将每个单词解释为要导出的变量。

将其更改为

export PATH="/bin:/root/.nvm/versions/node/v16.13.2/bin:/root/.cache/cloud-code/installer/google-cloud-sdk/bin:/root/.vscode-server/bin/d045a5eda657f4d7b676/bin/remote-cli:/root/.local/share/solana/install/active_release/bin:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/lonar/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/lonar/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin:/usr/local/go/bin:/root/go/bin"

一般来说,root不鼓励这样工作。您应该以普通用户身份执行大多数操作,并且仅在root绝对必要时才运行命令。

将所有这些 Windows 目录放在/mnt/c/...您的 PATH 中没有多大意义。

也许您在按照一些说明修改PATH变量时犯了一个错误。

相关内容