Skip to content
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

when install in another partition npm is not working #46

Closed
cckowin opened this issue Mar 4, 2015 · 7 comments
Closed

when install in another partition npm is not working #46

cckowin opened this issue Mar 4, 2015 · 7 comments

Comments

@cckowin
Copy link

cckowin commented Mar 4, 2015

when i install the nvm in d:\nvm
and use nvm install latest 32 to install node
it seems npm is not installed properly
the node_modules under the latest installed node is empty
i view the code, and the problem seem to be
this line in nvm.go:

os.Rename(os.TempDir()+"\\nvm-npm\\npm-"+npmv,env.root+"\\v"+version+"\\node_modules\\npm")

it seems using os.Rename to rename directories between different partitions is not working properly
issue #24 may be related

@coreybutler
Copy link
Owner

I assume your d drive is another physical disk in the computer, as opposed to a mapped network drive?

@cckowin
Copy link
Author

cckowin commented Mar 5, 2015

no, my computer has only one physical disk
i download the go and try the code my self
the test code is below:

package main
import "os"

func main() {
    os.Rename("e:\\test\\test\\test_a", "e:\\test\\test\\test_b");
    os.Rename("e:\\test\\test\\test_b", "d:\\test_b"); //not working
    os.Rename("e:\\test\\test\\test_file_a", "d:\\test_file_a");
}

test_a is a directory, test_file_a is a file
and the result is os.Rename works when rename files between two partiton, and
not work when rename directories between two partion

@coreybutler
Copy link
Owner

Which version of Go did you use to run your test?

@cckowin
Copy link
Author

cckowin commented Mar 6, 2015

e:\test\test> go version
go version go1.4.2 windows/amd64

@inoc603
Copy link
Contributor

inoc603 commented Mar 19, 2015

ran into the same issue on windows8.1, with go 1.4.2. I tried to catch the err with:

err := os.Rename(os.TempDir()+"\\nvm-npm\\npm-"+npmv,env.root+"\\v"+version+"\\node_modules\\npm")
 if err != nil {
    fmt.Println(err)
    os.Exit(1)
}

And it turned out there is one:
Installing npm v2.5.1...rename C:\Users\MY_USERNAME\AppData\Local\Temp\nvm-npm\npm-2.5.1 E:\nvm\v0.12.0\node_modules\npm: Access is denied.

@inoc603
Copy link
Contributor

inoc603 commented Mar 19, 2015

Update

I made some change to fix the problem. Instead of using system temp dir, I created a new directory temp under the nvm root and do all the work there.

I changed func GetNpm(v string) to func GetNpm(root string, v string), pass the nvm root path like in func GetNodeJS(root string, v string, a string).

Works fine.

I'll make a pull request soon. In fact this is the first time I write sth in Go, never touched it before trying to solve this problem. Hopefully I'm coding in the right manner, really know little about Go.

inoc603 added a commit to inoc603/nvm-windows that referenced this issue Mar 19, 2015
download and unzip npm in a temp directory under the nvm root. fix issue
coreybutler#46
@atroo
Copy link

atroo commented May 15, 2015

Hello to all of you, First of all thx for this great tool. Second: Nice seeing that this fix is already incooperated into the codebase because it hit me today as well. Are there any plans (especially a date) when a new release of the node-nvm will land?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants