Closed hmmdeif closed 5 years ago
Can you show me the full command you're using so I can reproduce this?
docker run --rm -v "$PWD":/var/task lambci/lambda:build-nodejs10.x npm install bcrypt
Note that docker run --rm -v "$PWD":/var/task lambci/lambda:build-nodejs8.10 npm install bcrypt
works as expected, but I assume this might be because bcrypt has prebuilt binaries for 8.10.
Hmmm, this works for me:
docker run --rm -v "$PWD":/var/task lambci/lambda:build-nodejs10.x npm rebuild --build-from-source
> bcrypt@3.0.6 install /var/task/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using needle for node-pre-gyp https download
make: Entering directory `/var/task/node_modules/bcrypt/build'
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
SOLINK_MODULE(target) Release/obj.target/bcrypt_lib.node
COPY Release/bcrypt_lib.node
COPY /var/task/node_modules/bcrypt/lib/binding/bcrypt_lib.node
TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory `/var/task/node_modules/bcrypt/build'
It might be that a bad image was pushed up or built on docker hub? Lemme check
Yeah a rebuild --build-from-source
works fine, it's just that initial install that fails.
That works fine for me too:
docker run --rm -v "$PWD":/var/task lambci/lambda:build-nodejs10.x npm install bcrypt
> bcrypt@3.0.6 install /var/task/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using needle for node-pre-gyp https download
[bcrypt] Success: "/var/task/node_modules/bcrypt/lib/binding/bcrypt_lib.node" is installed via remote
npm WARN saveError ENOENT: no such file or directory, open '/var/task/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/var/task/package.json'
npm WARN task No description
npm WARN task No repository field.
npm WARN task No README data
npm WARN task No license field.
+ bcrypt@3.0.6
updated 1 package and audited 431 packages in 6.796s
found 0 vulnerabilities
It might be an npm issue? Or you've got an old version of bcrypt or something? Try installing from scratch in an empty directory (with no package.json or node_modules or whatever) – it should succeed
Still no luck with that either. I can't see why it would be the host env but I am running this command on windows 10. I'm not too bothered since there is the rebuild command. If you're not getting the error then that's probably good enough to make it a non-issue!
Maybe something to do with the way the directory is being mounted? Check if this works:
docker run --rm lambci/lambda:build-nodejs10.x bash -c "cd /tmp && npm install bcrypt"
(also, just double-check you've got the latest image: docker pull lambci/lambda:build-nodejs10.x
)
Yep, that command worked and it is the latest image.
So I don't really know much about how Docker works on Windows and how the command line is interpreted. It could be that the directory you're in isn't accessible to Docker, or the command line doesn't know how to process "$PWD"
, or... dunno, a million things 😬
If you figure it out, let me know.
Unsure if this is due to the docker image or not (not really that familiar with building linux deps). I was upgrading my layers to node10.x and bcrypt would fail installing with:
In the end I just installed on 8.10 and then used
npm rebuild bcrypt --build-from-source
so there is a workaround. It could be this is a bcrypt problem but I'm unsure where exactly the issue lies.