为什么按需提供node

编程入门 行业动态 更新时间:2024-10-10 15:23:51

为什么<a href=https://www.elefans.com/category/jswz/34/1766832.html style=按需提供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中是可选的,因为它是一个巨大的体系结构决策,因此使其成为可选,并且仅在需要按需的极少数情况下才用于手动安装。

更多推荐

为什么按需提供node

本文发布于:2024-05-07 10:00:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1755721.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:按需   node

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!