node.js - 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?
解决方案
第 1 步:检查路径并验证您是否能够看到路径中的节点。第 2 步:关闭终端并打开一个新终端,然后再次执行第 1 步 第 3 步:如果路径中仍然不可用,请转到节点安装文件夹并尝试使用节点位置更新路径变量。第 4 步:再次执行第 1 步。
推荐阅读
- api - 在 RingCentral SCIM 2.0 API 中搜索/列出用户过滤器表达式语法
- python - 为什么我们需要在调用类函数时将 self 作为参数传递?
- r - 为字符添加双引号
- python - 从 Prodigy 的用于标记 NER 的 JSONL 格式转换为 spaCy 的训练格式?
- python - 我可以在 AWS Lambda 函数中使用 Pillow 和 numpy 吗?
- amazon-web-services - 我们可以使用复制命令使用访问密钥和密钥将数据从 S3 加载到红移表中吗(不使用 IAM 角色)
- javascript - 你可以在 promise 的 catch javascript 块中使用 await 吗?
- javascript - TypeError:当组件是具有 Vue.extended 的生成器时,无法读取组件实例上未定义的属性“_t”
- r - 字符串中的 R markdown 换行符(R Studio)
- lisp - 合并符号在 Common Lisp 中保持大小写