How to install Maven into my project and getting no command found

问题描述 投票:0回答:1

我尝试使用

npm install maven
在本地安装 Maven,然后在终端中运行它,它显示
mvn command not found
然后我尝试使用
npm install maven -g
全局安装它,我收到一个错误:

npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/maven
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/maven'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/maven'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/maven'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

我在 macOS 13.2.1.

我用

sudo
运行了命令,看起来它已经安装了,但仍然找不到命令
mvn command not found

node.js maven npm
1个回答
0
投票

一个可能的解决方法是:

sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

您可以在this similar question中找到有关此问题的更多信息。

© www.soinside.com 2019 - 2024. All rights reserved.