Skip to content

Commit

Permalink
Resolved terminal FOUC, closes #1196. Added debugging for author-nvm …
Browse files Browse the repository at this point in the history
…bridge.
  • Loading branch information
coreybutler committed Dec 29, 2024
1 parent de4ee40 commit 54e1a77
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/author/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ func Bridge(args ...string) {
}

if len(args) < 2 {
fmt.Printf("error: invalid number of arguments passed to author bridge: %d\n", len(args))
os.Exit(1)
if !(len(args) == 1 && args[0] == "version") {
fmt.Printf("error: invalid number of arguments passed to author bridge: %d\n", len(args))
os.Exit(1)
}
}

command := args[0]
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nvm",
"version": "1.2.0",
"version": "1.2.1",
"description": "Node.js version manager for Windows",
"license": "SEE LICENSE IN LICENSE",
"author": "coreybutler",
Expand Down
13 changes: 12 additions & 1 deletion src/nvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,17 @@ func checkLocalEnvironment() {

v := node.GetInstalled(env.root)

// Make sure author-nvm.exe is available and runs
exe, _ := os.Executable()
valueBytes, err := exec.Command(exe, "author", "version").Output()
authorNvmVersion := "Not Detected"
if err != nil {
// fmt.Println("Error running author-nvm.exe: " + err.Error())
problems = append(problems, "The author-nvm.exe file is missing or not executable.")
} else {
authorNvmVersion = strings.TrimSpace(string(valueBytes))
}

nvmhome := os.Getenv("NVM_HOME")
mirrors := "No mirrors configured"
if len(env.node_mirror) > 0 && len(env.npm_mirror) > 0 {
Expand All @@ -1547,7 +1558,7 @@ func checkLocalEnvironment() {
} else if len(env.npm_mirror) > 0 {
mirrors = env.npm_mirror + " (npm)"
}
fmt.Printf("\nNVM4W Version: %v\nNVM4W Path: %v\nNVM4W Settings: %v\nNVM_HOME: %v\nNVM_SYMLINK: %v\nNode Installations: %v\nDefault Architecture: %v-bit\nMirrors: %v\nHTTP Proxy: %v\n\nTotal Node.js Versions: %v\nActive Node.js Version: %v", NvmVersion, path, home, nvmhome, symlink, env.root, env.arch, mirrors, env.proxy, len(v), out)
fmt.Printf("\nNVM4W Version: %v\nNVM4W Author Bridge: %v\nNVM4W Path: %v\nNVM4W Settings: %v\nNVM_HOME: %v\nNVM_SYMLINK: %v\nNode Installations: %v\nDefault Architecture: %v-bit\nMirrors: %v\nHTTP Proxy: %v\n\nTotal Node.js Versions: %v\nActive Node.js Version: %v", NvmVersion, authorNvmVersion, path, home, nvmhome, symlink, env.root, env.arch, mirrors, env.proxy, len(v), out)

if !nvmsymlinkfound {
problems = append(problems, "The NVM4W symlink ("+env.symlink+") was not found in the PATH environment variable.")
Expand Down

0 comments on commit 54e1a77

Please sign in to comment.