在 Linux 上的 Node 中"Permission Denied",当运行 start-script /w local nodemon/mocha/babel-node 时



我的新 linux 设置遇到了问题 - 我已经将 nodemon 安装为本地依赖项(不是全局的),我正在尝试从我的 package.json "start"-script 执行它。我收到此权限错误。

node本身效果很好,但是一旦我尝试使用babel-nodenodemon甚至mocha,我就会遇到权限问题。

我的设置分为 2 个硬盘驱动器 - 节点安装在我的 SSD(使用我的操作系统)上,我的项目(它是node_modules,我尝试从哪里执行nodemon在我的存储 HDD 上。

sh: 1: nodemon: Permission denied
npm ERR! Linux 3.19.0-56-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v5.9.0
npm ERR! npm  v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! vyggo-easyrtc@1.0.0 start: `nodemon --exec node entry`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the vyggo-easyrtc@1.0.0 start script 'nodemon --exec node entry'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the vyggo-easyrtc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     nodemon --exec node entry
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs vyggo-easyrtc
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls vyggo-easyrtc
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     /media/goatic/HDD/Projects/Node/vyggo-easyrtc/npm-debug.log
goatic@goatic-laptop:/media/goatic/HDD/Projects/Node/vyggo-easyrtc$

将我的项目从 NTFS 文件系统移动到 Linux 后,我遇到了这个问题。 我将所有文件/目录权限更改为 644/755,并设置了所有者/组。 那时我开始收到此错误。

当我在终端中尝试nodemon时,我得到了command not found. 奇怪。

重新安装节点修复了它:

sudo npm install -g nodemon

我的辅助驱动器在权限方面与我的 Linux 操作系统不兼容,因为它是 NTFS 分区。

最终将所有内容都移动到我的主驱动器,当然权限再次起作用,允许我执行本地依赖项。

我想如果我依靠将项目保留在辅助驱动器上,我的问题的解决方法是将其格式化为与 Linux 权限兼容的格式。

我遇到了同样的问题。就我而言,当我将操作系统更改为Linux Ubuntu,20.04.1版本时,重新安装nodemon解决了问题。

对于 Linux 用户:

sudo npm install -g nodemon 

对于Windows用户,打开一个新终端或cmd提示符只需写:

npm install -g nodemon

有关详细信息,请查看nodemon文档:

节点文档

如果您在 MAC 中使用安装。

sudo npm install -g nodemon --unsafe-perm.

它会起作用。

当我git克隆最初在Windows机器上创建的项目时,我解决了这个问题,我的简单解决方案是删除.node_modules目录,然后运行npm install,这解决了我的问题。

奇怪,我遇到了同样的问题,除了我通过用nodemon devStart替换Nodemon devStart来解决它,突然错误消失了:)

相关内容

最新更新