【发布时间】:2020-09-23 20:38:57
【问题描述】:
我有一个运行 Ubuntu Server 20.04LTS 的 VM,我想使用 PM2 运行一个 nodejs 程序。我在安装 pm2 npm install -g pm2@latest 和 sudo npm install -g pm2@latest 时遇到问题。
npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /usr/lib/node_modules/pm2/node_modules/mocha/node_modules/mkdirp/bin/cmd.js
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/lib/node_modules/pm2/node_modules/mocha/node_modules/mkdirp/bin/cmd.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-06-04T18_01_48_656Z-debug.log
Ps:我尝试了npm install -g npm@latest 并清理了 npm 缓存,但似乎没有任何效果。该错误表明该文件不存在,但尽管知道这一点,但我不知道我能做什么或导致问题的原因。我不知道这是否会影响某些东西,但我处于 root 模式
【问题讨论】:
-
试过用 sudo 安装?
-
是的,在 root 上你真的不需要使用 sudo,但我还是尝试了 sudo 并得到了相同的结果
标签: node.js npm pm2 ubuntu-server