相关疑难解决方法(0)

如何将NodeJS和NPM更新到下一个版本?

我刚刚安装Node.jsnpm(用于其他模块).

如何将Node.js和我正在使用的模块更新到最新版本?

可以npm这样做,还是我必须删除并重新安装Node.js和npm才能获得下一个版本?

我按照npm节中的步骤操作.

node.js npm node-modules npm-update

1573
推荐指数
41
解决办法
140万
查看次数

DeprecationWarning:当我将脚本移动到另一台服务器时,由于安全性和可用性问题,不推荐使用Buffer()

脚本移动到其他服务器时出错.

(node:15707)[DEP0005] DeprecationWarning:由于安全性和可用性问题,不推荐使用Buffer().请改用Buffer.alloc(),Buffer.allocUnsafe()或Buffer.from()方法.

当前版本:

Ubuntu 16.04.4 LTS  
Node - v10.9.0  
NPM - 6.2.0  
Run Code Online (Sandbox Code Playgroud)

上一版本:

Ubuntu 14.04.3 LTS
NPM - 3.10.10
Node - v6.10.3
Run Code Online (Sandbox Code Playgroud)


exports.basicAuthentication = function (req, res, next) {
    console.log("basicAuthentication");
    if (!req.headers.authorization) {
        return res.status(401).send({
            message: "Unauthorised access"
        });
    }
    var auth = req.headers.authorization;
    var baseAuth = auth.replace("Basic", "");
    baseAuth = baseAuth.trim();
    var userPasswordString = new Buffer(baseAuth, 'base64').toString('ascii');
    var credentials = userPasswordString.split(':');

    var username = credentials[0] !== undefined ? credentials[0] : '';
    var password = credentials[1] !== undefined ? …
Run Code Online (Sandbox Code Playgroud)

node.js npm

78
推荐指数
3
解决办法
5万
查看次数

标签 统计

node.js ×2

npm ×2

node-modules ×1

npm-update ×1