简体   繁体   English

如何在Vagrant VM上安装bcrypt?

[英]How do I install bcrypt on Vagrant VM?

When I try to install bcrypt I get this error 当我尝试安装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

I have a fresh install of the latest version of node and npm. 我全新安装了最新版本的node和npm。 What should I do in similar cases?! 在类似情况下我该怎么办?!

Problem solved by replacing "bcrypt" with "bcryptjs". 用“bcryptjs”替换“bcrypt”解决了问题。

Source: Error installing bcrypt with npm 来源: 使用npm安装bcrypt时出错

But still no way to install bcrypt 但仍无法安装bcrypt

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. 我认为根本原因是我们无法在/ vagrant(特殊目录)中安装bcrypt,它会链接回主机操作系统目录。

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. 在这种情况下,如果要解决它,可以将项目从/ vagrant / example复制到实际目录,即。 ~/example. 〜/例子。

Then you would be able to install bcrypt from there. 然后你就可以从那里安装bcrypt了。

** bcrypt is a library that has strong dependencies on the OS native environ ** bcrypt是一个对OS本机环境具有强大依赖性的库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM