昨晚搜索了一下升级node和npm的方法,复制粘贴了一些建议,然后升级到了稳定版本。
我还按照论坛用户的建议安装了 NVM。
但是今天早上当我启动 Ubuntu 时,我收到以下弹出消息:
加载 /home/ron/.profile 时发现错误
/home/ron/.profile line 24: export /home/ron/.npm/bin not a valid identifier
因此会话将无法正确配置。您应尽快修复此问题。”
我还注意到我的第二台显示器在系统设置中没有被 Ubuntu 识别。
我是一个新手,几个月前才开始使用 Ubuntu。我不知道从哪里开始解决这个问题——非常感谢您分享您的智慧。
GNU nano 2.2.6
文件:/home/ron/.profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/ron/dev/npm/bin
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/ron/dev/npm/bin: /home/ron/.npm/bin
答案1
错误发生在文件的第 24 行~/.profile
:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/ron/dev/npm/bin: /home/ron/.npm/bin
具体来说,这就是您这里的空间:
... /usr/local/games:/home/ron/dev/npm/bin: /home/ron/.npm/bin
^
|---- Space, bad!
因此,打开该文件(nano ~/.profile
在终端中运行)并删除空格:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/ron/dev/npm/bin:/home/ron/.npm/bin
您还可以删除第一行export PATH...
。您只需要第二行。