无法在Vagrant虚拟机上使用NodeJS 10.15.3和NPM 6.4.1在Vuejs 2.6.9 / Webpack 4.29.6项目的服务器上安装bcrypt

问题描述 投票:0回答:1

我整个周末一直在努力安装bcrypt。在周末的过程中,我将Node更新为版本10.15.3(和npm 6.4.1)。

一个可能的解决方案是忘记bcrypt并安装bcryptjs。我的(可能毫无根据?)关注的是bcryptjs的最新版本(2.4.3)是2年,而bcrypt有持续支持的好处。我想在我的项目中使用bcrypt。

这是我得到的错误:

vagrant [server]> npm install bcrypt
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! path /vagrant/barbershop-pevn/server/node_modules/bcrypt/node_modules/minipass/node_modules/yallist/package.json.3160920247
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/vagrant/barbershop-pevn/server/node_modules/bcrypt/node_modules/minipass/node_modules/yallist/package.json.3160920247'

在服务器文件夹上......

的package.json

{
    "name": "server",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
        "start": "./node_modules/nodemon/bin/nodemon.js src/app.js --exec 'npm run lint && node'",
        "lint": "./node_modules/.bin/eslint \"**/*.js\""
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "dependencies": {
        "body-parser": "^1.18.3",
        "cors": "^2.8.5",
        "dotenv": "^7.0.0",
        "express": "^4.16.4",
        "joi": "^14.3.1",
        "jsonwebtoken": "^8.5.0",
        "morgan": "^1.9.1",
        "pg": "^7.9.0",
        "pg-hstore": "^2.3.2",
        "semver": "^5.6.0",
        "sequelize": "^5.1.0"
    },
    "devDependencies": {
        "eslint": "^5.15.3",
        "eslint-config-airbnb-base": "^13.1.0",
        "eslint-plugin-import": "^2.16.0",
        "eslint-plugin-vue": "^5.2.2",
        "nodemon": "^1.18.10"
    }

}

npm list -g --depth=0回归:

/home/vagrant/.nvm/versions/node/v10.15.3/lib
├── @vue/[email protected]
├── @vue/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

cat /etc/*release回归:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.6 LTS"
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

我的mac操作系统:10.13.6

主要编辑1:

我做了以下事情:

vagrant [server]> sudo apt install node-gyp

然后我收到了这个错误:

vagrant [server]> npm install bcrypt
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! path /vagrant/barbershop-pevn/server/node_modules/bcrypt/node_modules/minipass/node_modules/safe-buffer/package.json.3118274111
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/vagrant/barbershop-pevn/server/node_modules/bcrypt/node_modules/minipass/node_modules/safe-buffer/package.json.3118274111'

我错过了什么?任何帮助安装bcrypt或至少指向正确方向的帮助都非常感谢。

node.js server vuejs2 bcrypt webpack-4
1个回答
0
投票

我认为这是一个npm问题。我可以在NodeJS版本8.15.1和10.15.3上使用yarn或pnpm(看起来很有吸引力)成功安装bcrypt。我的问题是关于安装bcrypt(不一定使用npm)所以我要说我暂时得到了一个满意的答案:使用yarn或pnpm(或者只是安装brcyptjs)。我在github上提出了一个issue

© www.soinside.com 2019 - 2024. All rights reserved.