问题
When I try to install bcrypt I get this error
[vagrant@localhost example]$ npm install bcrypt --save
npm ERR! path /vagrant/example/node_modules/bcrypt/node_modules/minipass/node_modules/yallist/package.json.2764337951
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/vagrant/example/node_modules/bcrypt/node_modules/minipass/node_modules/yallist/package.json.2764337951'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vagrant/.npm/_logs/2018-06-01T03_52_29_028Z-debug.log
I have a fresh install of the latest version of node and npm. What should I do in similar cases?!
回答1:
Problem solved by replacing "bcrypt" with "bcryptjs".
Source: Error installing bcrypt with npm
But still no way to install bcrypt
回答2:
I had that issue.
I think the root cause is that we can't install bcrypt in the /vagrant (special directory) where it links back to the host OS directory.
That directory is like a virtual directory. At such, if you want to solve it you could copy your project from /vagrant/example to an actual directory , ie. ~/example.
Then you would be able to install bcrypt from there.
** bcrypt is a library that has strong dependencies on the OS native environ
来源:https://stackoverflow.com/questions/50635925/how-do-i-install-bcrypt-on-vagrant-vm