Command ‘npm‘ not found, but can be installed with:sudo apt install npm 解决方案

问题描述

今天在执行

bash 复制代码
npm install -g npx

报错

Command 'npm' not found, but can be installed with:

sudo apt install npm

解决方案

bash 复制代码
sudo apt-get remove npm
sudo apt-get remove nodejs-legacy
sudo apt-get remove nodejs
sudo rm /usr/bin/node
sudo apt-get install nodejs
sudo apt-get install nodejs-legacy
sudo apt-get install npm.

参考链接

npm: command not found解决方案(已解决) - 知乎

相关推荐
荒--16 小时前
Ubuntu软件包查询,弹框下载文件
运维·服务器·ubuntu
定栓17 小时前
Webpack迁到Vite第五节:第三方库兼容
前端·webpack·node.js
闲云自留地17 小时前
CentOS 搬 Ubuntu 24.04:yum 变 apt、防火墙、SELinux、root 全差异避坑
linux·ubuntu·centos
xiaobobo333021 小时前
Ubuntu 26.04环境中如何使用中文man手册以及man手册默认中文显示
ubuntu·中文man手册·man手册默认中文显示·简化man·cheat
菜菜的院子21 小时前
WSL2 运行 Ubuntu 26.04 完整 GNOME 桌面(WSLg Wayland)
linux·运维·ubuntu·wsl
G018_star sky♬1 天前
如何用nodejs写一个简单后端服务
node.js
kiracrimson1 天前
npm 入门:包管理器、依赖与 npx
前端·npm·node.js
KIDULT°1 天前
Kubeadm 部署 Kubernetes v1.30.2 实战:Ubuntu24.04 三节点集群 + 排坑记录
ubuntu·云原生·容器·kubernetes·k8s
xiaobobo33301 天前
man手册的格式、共性、命令
ubuntu·man手册结构·man手册共性·man手册命令