-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm 命令可以用,node 命令不能使用 #70
Comments
这个目录下应该会有一个node.exe文件的,方便告知一下该文件不存在的原因吗(自己手动删除了或者更新新版本之后就这样了……) 目前提供一个简单的解决方法,复制nvmd.exe并重命名为node.exe即可(在截图的这个目录下) |
你试试将 注意需要使用管理员权限运行 |
删了,安装2遍都不行,用的管理员权限,复制nvmd.exe重命名为node.exe可以 |
这就奇怪了 这些文件都是在启动的时候会复制写入到 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;
} 然后当后续版本升级时会替换掉所有的 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;
} 根据你们的截图来看 是有一些成功了有一些失败了 目前没有什么头绪.....感觉还是跟系统的权限有一些关系..... |
@Yfkj01 @EdenSpark 你们方便安装一下这个版本运行吗:Release test_log 里面添加了一些日志的记录
然后麻烦提供一下这个日志文件,以用来定位具体的问题。谢谢 🌹 |
出现了和这个问题反过来的问题。npm.exe不存在,但是node.exe存在 |
@lainbo 你可以试试安装 Release test_log 这个版本吗 然后安装说明提供一下log文件 以便定位到具体问题 |
This issue is stale because it has been open for 30 days with no activity. |
This issue was closed because it has been inactive for 14 days since being marked as stale. |
nvm-desktop 3.2.0 版本
win 10 系统
The text was updated successfully, but these errors were encountered: