node.js - 带有 Docker 的 Ubuntu 服务器的 NodeJS 问题

标签 node.js ubuntu

我使用以下命令安装 nodejs:
sudo apt install nodejs
然后当安装完成
我试图运行一些脚本但有错误

[我的脚本命令]

enter image description here

当我使用 nodejs 运行此脚本时,会发生错误

enter image description here

我的 ubuntu 版本和 Nodejs 版本:

enter image description here

最佳答案

卸载该nodejs版本

sudo apt-get remove nodejs

安装最新版本的nodejs
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs

在此之后尝试运行您的文件
node yourfile

关于node.js - 带有 Docker 的 Ubuntu 服务器的 NodeJS 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60407211/

相关文章:

node.js - 如何杀死nodejs中 `spawn`创建的docker容器?

javascript - HTML 分页问题

node.js - 谷歌的 recaptcha api 的无效输入 secret

mongodb - 无法使用 mongo shell 连接到远程 mongodb

python - 使用 Ubuntu 16.04 获取 wxPython 并将其与 Pycharm 一起使用

amazon-web-services - 测试 Amazon RDS 实例与外部服务器之间的连接延迟

node.js - 在 nodejs 的 swagger.yaml 中使用环境变量

mysql - 在前端或后端验证必填字段的正确方法是什么?

apache - 配置tomcat7和apache2

linux - 如何将 64 位 .deb 文件转换为 32 位 .deb 文件