Node.js 如何在Vagrant VM上安装bcrypt?

Node.js 如何在Vagrant VM上安装bcrypt?,node.js,npm,bcrypt,Node.js,Npm,Bcrypt,当我试图安装bcrypt时,我遇到了这个错误 [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! syscal

当我试图安装bcrypt时,我遇到了这个错误

[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
我已经重新安装了node和npm的最新版本。
在类似的情况下我该怎么办

将“bcrypt”替换为“bcryptjs”解决了问题

资料来源:

但是仍然无法安装bcrypt,我遇到了这个问题

我认为根本原因是我们无法将bcrypt安装在/vagrant(特殊目录)中,它在该目录中链接回主机OS目录

该目录类似于虚拟目录。在这种情况下,如果您想解决它,您可以将您的项目从/vagrant/example复制到实际目录,即~/example

然后您就可以从那里安装bcrypt了


**bcrypt是一个对操作系统本机环境有很强依赖性的库

该目录中是否有package.json?是的,我有package.json