如何在Vagrant虚拟机上安装bcrypt?

4
当我尝试安装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。在类似情况下,我应该怎么做?!


你在那个目录下有 package.json 文件吗? - Harshal Yeole
是的,我有 package.json 文件。 - tuxohaib
2个回答

0

0

我曾经遇到过这个问题。

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

那个目录就像一个虚拟目录。如果你想解决这个问题,你可以将你的项目从/vagrant/example复制到一个实际的目录,比如~/example。

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

** bcrypt是一个具有强烈依赖于操作系统本地环境的库。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接