我使用 NodeSource PPA 在 Ubuntu 19.10 上安装了 node、npm 和 angular:
sudo apt install curl
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install --global @angular/[email protected]
在我升级到 Ubuntu 20.04 之前,它一直正常工作。尝试创建一个新的 Angular 项目后,它显示:
/usr/bin/env: 'node': No such file or directory
我尝试获取 node、npm 和 angular 版本,但它说它们尚未安装。然后我输入:
sudo apt-get install nodejs
为了看看会发生什么,因为我已经安装了所有这些:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW package will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove, and 0 not upgraded.
Need to get 18.0 MB of archives.
After this operation, 92.2 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_12.x focal/main amd64 nodejs amd64 12.18.0
-deb-1nodesource1 [18.0 MB]
Fetched 18.0 MB in 1min 9s (260 KB/s)
Selecting previously unselected package nodejs.
(Reading database ... 162832 files and directories currently installed.)
Preparing to unpack ... /nodejs_12.18.0-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (12.18.0-deb-1nodesource1) ...
Setting up nodejs (12.18.0-deb-1nodesource1) ...
Processing triggers for man-db (2.9.1-1)
这样,我解决了这个问题,并且我的机器现在可以识别角度,但仍有两个问题:
- 为什么升级 Ubuntu 后会出现这种情况?
- 我该如何修复它呢?
提前致谢,