Skip to content

Commit

Permalink
fix: 修复编译
Browse files Browse the repository at this point in the history
  • Loading branch information
engsr6982 committed Dec 28, 2024
1 parent 4f9cc0b commit d09d773
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/Loader/JavaScriptPluginLoader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ endstone::Plugin* JavaScriptPluginLoader::loadPlugin(std::string file) {
data->mFileName = path.filename().string();

// 安装依赖
if (NodeManager::packageHasDependency(path.parent_path() / "package.json")) {
if (NodeManager::packageHasDependency(path.parent_path() / "package.json")
&& !NodeManager::packageHasDependency(path.parent_path() / "node_modules")) {
Entry::getInstance()->getLogger().info("Installing dependencies for plugin: {}", path.filename());
manager.NpmInstall(path.parent_path().string());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Manager/NodeManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ bool NodeManager::NpmInstall(string npmExecuteDir) {
}
success = node::SpinEventLoop(env).FromMaybe(1) == 0;
} catch (...) {
Entry::getInstance()->getLogger().error("Failed to run npm command: {}", cmd);
Entry::getInstance()->getLogger().error("Failed to run npm install");
}

node::Stop(env);
Expand Down
4 changes: 2 additions & 2 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ add_rules("mode.debug", "mode.release")
add_repositories("levilamina https://github.com/LiteLDev/xmake-repo.git")
add_repositories("iceblcokmc https://github.com/IceBlcokMC/xmake-repo.git")

add_requires("node 16.20.2") -- iceblockmc
add_requires("nodejs 16.20.2") -- iceblockmc
add_requires(
"endstone 0.5.6",
"expected-lite 0.8.0",
Expand Down Expand Up @@ -40,7 +40,7 @@ target("Js_Engine")
)
add_files("src/**.cc")
add_includedirs("src")
add_packages("node")
add_packages("nodejs")
add_packages(
"fmt",
"expected-lite",
Expand Down

0 comments on commit d09d773

Please sign in to comment.