最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

为什么按需提供node

网站源码admin22浏览0评论

为什么按需提供node

为什么按需提供node

我正在尝试为SPA SharePoint Online应用程序设置全新的angular 9应用程序本地开发环境。

作为该过程的一部分,我需要设置本地代理服务器sp-rest-proxy。我将其配置为使用按需凭据。这是config/private.json内容:

{
  "siteUrl": "",
  "strategy": "OnDemandCredentials",
  "ondemand": true
}

我的package.json文件包括:

{
   "scripts": {
       "serve": "node src/server.js"
    }
}

server.js的内容是:

const RestProxy = require('sp-rest-proxy');

const settings = {
  configPath: './config/private.json', // Location for SharePoint instance mapping and credentials
  port: 8080, // Local server port
  staticRoot: './node_modules/sp-rest-proxy/static' // Root folder for static content
};

const restProxy = new RestProxy(settings);
restProxy.serve();

我跑步:

npm run serve

当我尝试执行像http://localhost:8080这样的简单请求时,打开浏览器并将其指向/_api/web?$select=Title,会出现以下错误:

{
  "readyState": 4,
  "responseText": "Command failed: C:\\WINDOWS\\system32\\cmd.exe /d /s /c \"electron C:\\projects\\MyProject\\node_modules\\node-sp-auth\\lib\\src\\auth\\resolvers\\ondemand\\electron\\main.js  false\"",
  "status": 400,
  "statusText": "Bad Request"
}

没有显示浏览器窗口。

我在全球范围内安装了电子。

当我在命令行上执行以下操作时:

electron C:\projects\MyProject\node_modules\node-sp-auth\lib\src\auth\resolvers\ondemand\electron\main.js  false

没有任何反应,该过程以无消息结束,没有打开浏览器窗口。

我该怎么做才能发现并解决问题?

回答如下:

按需身份验证需要安装Electron npm i -g electron@6

Electron在node-sp-auth中是可选的,因为它是一个巨大的体系结构决策,因此使其成为可选,并且仅在需要按需的极少数情况下才用于手动安装。

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论