npm postinstall "npm WARN cannot run in wd" #3497
Comments
|
I believe 'wd' means working directory. NPM tries to downgrade its privileges when it runs scripts. That downgrading the privileges causes this error. |
|
As @mbilker mentioned, |
|
It seems that the problem I had was really down to the fact that I was using nvm and npm with a sudo user, where I really should have been using my user account. I reinstalled nvm for my user account without sudo, and this problem went away. Thanks for the help. |
|
also hit this on Ubuntu running as root user. |
|
Keep in mind that running with |
|
or you can use an external file called .npmrc with just the following content: unsafe-perm = true |
|
I fixed this by changing the ownership of
This allowed me to do everything without |
by running `npm install` as root. See npm/npm#3497.
This is required nowadays because at some point npm decided root users shouldn't be allowed to run install scripts. See also npm/npm#3497
by running `npm install` as root. See npm/npm#3497.
这样的话,使用 root 权限运行 postinstall 脚本就不会报错了(安全原因) see npm/npm#3497 SamHwang1990/blog#5
by running `npm install` as root. See npm/npm#3497.
Using: npm v1.2.14 & node v0.8.22
I have a simple package.json file with the following postinstall script:
However, every time I run
sudo npm installon my local OS X machine, I get the following error:npm WARN cannot run in wd myapp@3.2.33 sudo ./node_modules/.bin/grunt build (wd=/folder)I have tried changing the actual postinstall script to run grunt at different paths, and even just set it to
"echo postinstall"and it still fails.Why is NPM not allowing that postinstall script to work? What does
wdmean in this context?Thanks.
The text was updated successfully, but these errors were encountered: