Open tylercollier opened 8 years ago
If you want to reproduce, throw this in a package.json
in some empty directory and do npm install
:
{
"devDependencies": {
"lockdown": "0.0.8-dev"
},
"dependencies": {
},
"scripts": {
"preinstall": "lockdown"
}
}
Seeing the same error here on OSX 10.11.3:
npm ERR! Darwin 15.2.0
npm ERR! argv "/Users/nickvoegeli/.nodenv/versions/4.2.3/bin/node" "/Users/nickvoegeli/.nodenv/versions/4.2.3/bin/npm" "install"
npm ERR! node v4.2.3
npm ERR! npm v2.14.7
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! project@0.0.1 preinstall: `lockdown`
npm ERR! spawn ENOENT
I don't remember the context with this but it make sense that this fails because the module is not installed yet and you are trying to run this in the PREINSTALL step.
I'm not clear how it worked before, seems like there are some docs suggesting that it was possible before.
@vladikoff What your'e saying makes sense, but it can't be the issue, because I manually installed the package with npm install --save lockdown
, as suggested in the readme, as step 1. So, the module is installed when the preinstall step runs. Again, you can try this with the reproduction step I gave. In an empty directory, type npm install --save lockdown
. Then copy the package.json
I provided into the directory and run npm install
. Even though the lockdown package exists, you'll get the error.
Because I mentioned a work-around, this case can be closed, but I suggest the README should be updated with the workaround mentioned.
DISCLAIMER: I don't use Node, so I might be talking shit.
@tylercollier Sounds like either node_modules/.bin/
is not in $PATH
when the hook is executed, or the lockdown
file isn't set as executable or it has a wrong shebang.
Can you check that?
If you don't know how, the output of ls -Al node_modules/.bin/lockdown
and head node_modules/.bin/lockdown
are a good start.
@KellerFuchs should node_modules/.bin/
be in my path? It's not mentioned in the README, nor have I seen it as a common suggestion to do so. One would have to do that for each project they work on, right?
I gave a simple set of instructions for reproduction. One person said they saw the same problem, but @vladikoff didn't mention if he tried reproducing.
The instructions in the README say to add this to
package.json
:However, when I do that, I get this error:
To fix, I changed it to be:
which seems to work fine.
I'm guessing this has something to do with my environment (Ubuntu 14.04, using node 4.2.3 with nodenv, using npm 3.5.1)? Or I must be missing something if no one else has reported this. But what's happening makes sense to me. Simply having
lockdown
as a preinstall script shouldn't work, unless you've addednode_modules/.bin
to your PATH (environment variable) or something, right? But that's not part of the README.