首页 > 解决方案 > I encountered an error that could not find the npm and node on the server. /usr/bin/env: node: No such file or directory

问题描述

While I was developing, I thought I needed to update the node, and I downloaded it again after deleting the node.

sudo npm cache clean -f

sudo npm install -g n

sudo n stable

sudo ln -sf /usr/local/n/versions/node/6.0.0/bin/node /usr/bin/node

It looked like it was going smoothly, and I checked the node.

However, the console was floating /usr/bin/env: node: No such file or directory.

I tried ln -s /usr/bin/nodejs /usr/bin/node but the problem was not solved.

ln: failed to create symbolic link ‘/usr/bin/node’: File exists

I tried ln -s --f /usr/bin/nodejs /usr/bin/node too.

What should I do?

标签: node.jslinuxvue.jscentosnuxt.js

解决方案


第 1 步:检查路径并验证您是否能够看到路径中的节点。第 2 步:关闭终端并打开一个新终端,然后再次执行第 1 步 第 3 步:如果路径中仍然不可用,请转到节点安装文件夹并尝试使用节点位置更新路径变量。第 4 步:再次执行第 1 步。


推荐阅读