小程序云函数调用失败Cannot find module ‘wx-server-sdk‘

1.报错:

        errMsg: Runtime.ImportModuleError: Error: Cannot find module 'wx-server-sdk'

2.需安装:

        npm install --save wx-server-sdk@latest

3.报错:

        rollbackFailedOptional: verb npm-session

4.检查版本:

        npm -v

5.更新版本

        5.1.如果您的 npm 版本过旧,更新 npm:

                npm install -g npm@latest

        5.2.如果您使用的是全局安装的 npm,更新 npm:

                npm install npm@latest

        5.3如果以上命令无法更新,使用淘宝镜像:

                npm config set registry https://registry.npm.taobao.org

6.以上都不行

        6.1运行npm install

        6.2package.json

        {

                "dependencies" :{

                        "wx-server-sdk":"*"

                       }

        }

你可能感兴趣的:(小程序)