简体   繁体   English

Maven ERR_INVALID_CALLBACK(

[英]Maven ERR_INVALID_CALLBACK(

I have installed JDK and set up the home variable:我已经安装了 JDK 并设置了 home 变量:

C:\Workspace\ProjectFolder>echo %JAVA_HOME%
C:\Program Files\Java\jdk-11.0.6

Then i have done:然后我做了:

npm install maven -g

Info about the NODE: NODE的相关资料:

C:\Workspace\ProjectFolder>node --version
v10.16.3

Okay, lets see the info about MAVEN:好的,让我们看看关于 MAVEN 的信息:

C:\Workspace\ProjectFolder>mvn --version
fs.js:136
    throw new ERR_INVALID_CALLBACK();
    ^

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at makeCallback (fs.js:136:11)
    at Object.mkdir (fs.js:726:14)
    at Object.target.init (C:\Users\MyUSER\AppData\Roaming\npm\node_modules\mvn\target.js:25:10)
    at Object.<anonymous> (C:\Users\MyUSER\AppData\Roaming\npm\node_modules\mvn\target.js:39:8)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)

What is wrong?怎么了?

(The npm package you've installed is mvn , not maven .) (您安装的npm包是mvn ,而不是maven 。)

Because the .maven directory doesn't existing, it's attempting to create it with this line:因为.maven目录不存在,它试图用这一行创建它:

fs.mkdir(target.home); fs.mkdir(target.home);

However, it's calling mkdir without a callback.但是,它在没有回调的情况下调用mkdir Since Node 10, that's an error.从 Node 10 开始,这是一个错误。 You'll need to use an earlier Node, or fix the code to pass a callback.您需要使用较早的节点,或修复代码以传递回调。 See how to fix this error TypeError [ERR_INVALID_CALLBACK]: Callback must be a function for an equivalent change.查看如何修复此错误 TypeError [ERR_INVALID_CALLBACK]: Callback must be a function for an equivalent change。

If you're trying to use Maven, simply install it directly , rather than using a Node wrapper.如果您尝试使用 Maven,只需直接安装它,而不是使用 Node 包装器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 抛出新的 ERR_INVALID_CALLBACK(回调); - throw new ERR_INVALID_CALLBACK(callback); TypeError [ERR_INVALID_CALLBACK]: 回调必须是一个函数 - TypeError [ERR_INVALID_CALLBACK]: Callback must be a function TypeError [ERR_INVALID_CALLBACK]:回调必须是Express JS函数 - TypeError [ERR_INVALID_CALLBACK]: Callback must be a function Express JS 如何修复代码:'ERR_INVALID_CALLBACK' nodejs - How to fix code: 'ERR_INVALID_CALLBACK' nodejs 如何修复此错误 TypeError [ERR_INVALID_CALLBACK]: Callback must be a function - how to fix this error TypeError [ERR_INVALID_CALLBACK]: Callback must be a function TypeError [ERR_INVALID_CALLBACK]:回调必须是 function。 在nodejs中收到未定义 - TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined in nodejs express --view=hbs myapp getting [ERR_INVALID_CALLBACK]: Callback must be a function - express --view=hbs myapp getting [ERR_INVALID_CALLBACK]: Callback must be a function TypeError [ERR_INVALID_CALLBACK]中理解中的问题:回调必须是节点中的函数 - issue in understanding in `TypeError [ERR_INVALID_CALLBACK]: Callback must be a function` in node 我收到TypeError [ERR_INVALID_CALLBACK]:回调必须是一个函数 - I have got TypeError [ERR_INVALID_CALLBACK]: Callback must be a function [ERR_INVALID_CALLBACK]:使用 fs.writeFile 时,回调必须是 function - [ERR_INVALID_CALLBACK]: Callback must be a function when using fs.writeFile
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM