Giter Site home page Giter Site logo

Comments (10)

1111mp avatar 1111mp commented on June 11, 2024

这个目录下应该会有一个node.exe文件的,方便告知一下该文件不存在的原因吗(自己手动删除了或者更新新版本之后就这样了……)

目前提供一个简单的解决方法,复制nvmd.exe并重命名为node.exe即可(在截图的这个目录下)

from nvm-desktop.

EdenSpark avatar EdenSpark commented on June 11, 2024

刚重新安装遇到了同样的问题,设置版本后没有node命令
image

from nvm-desktop.

1111mp avatar 1111mp commented on June 11, 2024

你试试将%HOMEPATH%\.nvmd这个目录整个删除,然后再重新启动nvm-desktop客户端试试呢 看是否依旧会丢失node.exe文件

注意需要使用管理员权限运行

from nvm-desktop.

Yfkj01 avatar Yfkj01 commented on June 11, 2024

这个目录下应该会有一个node.exe文件的,方便告知一下该文件不存在的原因吗(自己手动删除了或者更新新版本之后就这样了……)

目前提供一个简单的解决方法,复制nvmd.exe并重命名为node.exe即可(在截图的这个目录下)

删了,安装2遍都不行,用的管理员权限,复制nvmd.exe重命名为node.exe可以

from nvm-desktop.

1111mp avatar 1111mp commented on June 11, 2024

这就奇怪了 这些文件都是在启动的时候会复制写入到%HOMEPATH%\.nvmd\bin目录下的 这是相关的代码:

async function updateToSchemaVersionDefault(version: number) {
  if (version >= 1) return;

  if (platform === "win32") {
    // windows
    await setNvmdToPathForWindows();

    const exeSourceFile = app.isPackaged
      ? join(process.resourcesPath, "assets", "sources", `${arch}.exe`)
      : join(__dirname, "../../..", "assets", "sources", `${arch}.exe`);
    const cmdSourceFile = app.isPackaged
      ? join(process.resourcesPath, "assets", "sources", "temp.cmd")
      : join(__dirname, "../../..", "assets", "sources", "temp.cmd");

    const promises: Array<Promise<void>> = [];

    promises.push(copy(exeSourceFile, join(BIN_DIR, "nvmd.exe")).catch((_err) => {}));

    ["node", "npm", "npx", "corepack"].forEach((name) => {
      promises.push(copy(exeSourceFile, join(BIN_DIR, `${name}.exe`)).catch((_err) => {}));

      if (name !== "node") {
        promises.push(copy(cmdSourceFile, join(BIN_DIR, `${name}.cmd`)).catch((_err) => {}));
      }
    });

    await Promise.all(promises);

    setSchemaVersion(CURRENT_MIGRATION_VERSION);
    return;
  }

  // remove file: .nvmd/shell
  if (await pathExists(`${APPDIR}/shell`)) {
    await remove(`${APPDIR}/shell`);
  }

  // remove file: .nvmd/nvmd.sh
  if (await pathExists(`${APPDIR}/nvmd.sh`)) {
    await remove(`${APPDIR}/nvmd.sh`);
  }

  // macOS
  const targetFile = join(BIN_DIR, "nvmd");

  const sourceFile = app.isPackaged
    ? join(process.resourcesPath, "assets", "sources", "nvmd")
    : join(__dirname, "../../..", "assets", "sources", "nvmd");

  await copy(sourceFile, targetFile).catch((_err) => {});

  await Promise.all(
    ["node", "npm", "npx", "corepack"].map((name) =>
      symlink(targetFile, join(BIN_DIR, name)).catch((_err) => {})
    )
  );

  setSchemaVersion(CURRENT_MIGRATION_VERSION);
  return;
}

然后当后续版本升级时会替换掉所有的*.exe的文件:

async function updateToSchemaVersionLast(version: number) {
  if (version >= CURRENT_MIGRATION_VERSION) return;

  // Macos or Linux
  if (platform !== "win32") {
    const targetFile = join(BIN_DIR, "nvmd");

    await remove(targetFile);

    const sourceFile = app.isPackaged
      ? join(process.resourcesPath, "assets", "sources", "nvmd")
      : join(__dirname, "../../..", "assets", "sources", "nvmd");
    await copy(sourceFile, targetFile).catch((_err) => {});

    await setSchemaVersion(CURRENT_MIGRATION_VERSION);
    return;
  }

  // Windows
  const targetFile = join(BIN_DIR, "nvmd.exe");

  await remove(targetFile);

  const sourceFile = app.isPackaged
    ? join(process.resourcesPath, "assets", "sources", `${arch}.exe`)
    : join(__dirname, "../../..", "assets", "sources", `${arch}.exe`);
  await copy(sourceFile, targetFile).catch((_err) => {});

  async function updateFile(fileName: string) {
    const filePath = join(BIN_DIR, fileName);

    await remove(filePath);

    await copy(sourceFile, filePath).catch((_err) => {});

    return;
  }

  const files = await readdir(BIN_DIR);

  await Promise.all(
    files.filter((name) => name.endsWith(".exe")).map((fileName) => updateFile(fileName))
  );

  await setSchemaVersion(CURRENT_MIGRATION_VERSION);
  return;
}

根据你们的截图来看 是有一些成功了有一些失败了 目前没有什么头绪.....感觉还是跟系统的权限有一些关系.....

from nvm-desktop.

1111mp avatar 1111mp commented on June 11, 2024

@Yfkj01 @EdenSpark 你们方便安装一下这个版本运行吗:Release test_log 里面添加了一些日志的记录

  • 安装好之后先删除%HOMEPATH%\.nvmd目录下的bin\目录和migration文件,然后再启动。
  • 启动之后日志会记录在%HOMEPATH%\.nvmd\main.log文件中

然后麻烦提供一下这个日志文件,以用来定位具体的问题。谢谢 🌹

from nvm-desktop.

lainbo avatar lainbo commented on June 11, 2024

出现了和这个问题反过来的问题。npm.exe不存在,但是node.exe存在

from nvm-desktop.

1111mp avatar 1111mp commented on June 11, 2024

@Yfkj01 @EdenSpark 你们方便安装一下这个版本运行吗:Release test_log 里面添加了一些日志的记录

  • 安装好之后先删除%HOMEPATH%\.nvmd目录下的bin\目录和migration文件,然后再启动。
  • 启动之后日志会记录在%HOMEPATH%\.nvmd\main.log文件中

然后麻烦提供一下这个日志文件,以用来定位具体的问题。谢谢 🌹

@lainbo 你可以试试安装 Release test_log 这个版本吗 然后安装说明提供一下log文件 以便定位到具体问题

from nvm-desktop.

github-actions avatar github-actions commented on June 11, 2024

This issue is stale because it has been open for 30 days with no activity.

from nvm-desktop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.