- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 TypeScript 在本地运行 Azure Function。我在 TypeScript 和 JS 领域有相当多的经验,但在这些消费类型的云服务方面却没有那么多经验。我正在运行最新版本的核心工具,因此运行 func -v
返回 3.0.3160
我尝试重新安装工具。同一问题在多台计算机和操作系统上仍然存在。
const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise<void> {
context.log('HTTP trigger function processed a request.');
// Contents of foo are irrelevant
foo(context, req);
context.res = {
status: 200,
};
};
export default httpTrigger;
"scripts": {
"clean": "rm -rf ./dist/*",
"build": "yarn run clean && tsc",
"prestart": "yarn run build && func extensions install",
"start:host": "func start --verbose",
"start": "yarn run start:host && yarn run watch",
"build:start": "yarn run build && yarn run start:host",
},
"dependencies": {
"@types/node": "^12.12.6",
"applicationinsights": "^1.8.8",
"axios": "^0.21.0",
"case": "^1.6.3",
"node-fetch": "^2.6.1",
"tslib": "^2.0.3",
"@azure/functions": "^1.2.2"
},
"devDependencies": {
"@types/node-fetch": "^2.5.7",
"typescript": "^4.1.2"
}
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"outDir": "dist",
"rootDir": "./src",
"moduleResolution": "Node"
},
"exclude": [
"node_modules"
]
}
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0]"
},
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
}
}
{
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "res"
}
],
"scriptFile": "../dist/function.js"
}
在本地运行 azure 函数时,我运行“yarn run build:start”并从它执行的脚本元素中运行 yarn 清洁、 yarn 构建和 yarn 运行开始。终端是这样的输出到控制台。
Worker was unable to load function src: 'Error: Cannot find module '@azure/functions'
[2020-12-23T19:16:24.136Z] Require stack:
[2020-12-23T19:16:24.136Z] - /~/Projects/events/dist/function.js
[2020-12-23T19:16:24.136Z] - /usr/local/Cellar/azure-functions-core-tools@2/2.7.3023/workers/node/worker-bundle.js
[2020-12-23T19:16:24.136Z] - /usr/local/Cellar/azure-functions-core-tools@2/2.7.3023/workers/node/dist/src/nodejsWorker.js'
[2020-12-23T19:16:24.146Z] Worker failed to function id cef7538d-d82e-400d-b29a-dbb3dacf3e7f.
[2020-12-23T19:16:24.146Z] Result: Failure
[2020-12-23T19:16:24.147Z] Exception: Worker was unable to load function src: 'Error: Cannot find module '@azure/functions'
[2020-12-23T19:16:24.147Z] Require stack:
[2020-12-23T19:16:24.147Z] - /~/Projects/events/dist/function.js
[2020-12-23T19:16:24.147Z] - /usr/local/Cellar/azure-functions-core-tools@2/2.7.3023/workers/node/worker-bundle.js
[2020-12-23T19:16:24.147Z] - /usr/local/Cellar/azure-functions-core-tools@2/2.7.3023/workers/node/dist/src/nodejsWorker.js'
[2020-12-23T19:16:24.147Z] Stack: Error: Cannot find module '@azure/functions'
[2020-12-23T19:16:24.147Z] Require stack:
[2020-12-23T19:16:24.147Z] - /~/Projects/events/dist/function.js
[2020-12-23T19:16:24.147Z] - /usr/local/Cellar/azure-functions-core-tools@2/2.7.3023/workers/node/worker-bundle.js
[2020-12-23T19:16:24.147Z] - /usr/local/Cellar/azure-functions-core-tools@2/2.7.3023/workers/node/dist/src/nodejsWorker.js
[2020-12-23T19:16:24.147Z] at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
[2020-12-23T19:16:24.147Z] at Function.Module._load (internal/modules/cjs/loader.js:667:27)
[2020-12-23T19:16:24.147Z] at Module.require (internal/modules/cjs/loader.js:887:19)
[2020-12-23T19:16:24.147Z] at Module.patchedRequire [as require] (/~/Projects/events/node_modules/diagnostic-channel/dist/src/patchRequire.js:14:46)
[2020-12-23T19:16:24.147Z] at require (internal/modules/cjs/helpers.js:74:18)
[2020-12-23T19:16:24.147Z] at Object.<anonymous> (/~/Projects/events/dist/function.js:47:1)
[2020-12-23T19:16:24.147Z] at Module._compile (internal/modules/cjs/loader.js:999:30)
[2020-12-23T19:16:24.147Z] at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
[2020-12-23T19:16:24.147Z] at Module.load (internal/modules/cjs/loader.js:863:32)
[2020-12-23T19:16:24.147Z] at Function.Module._load (internal/modules/cjs/loader.js:708:14).
最佳答案
有时,您可能会遇到 node_modules
的不稳定问题(出于多种原因),因此值得删除该文件夹并再次运行 yarn
。
您没有发布 yarn.lock
文件来验证 @azure/functions
是否已实际安装;忽视似乎是一件愚蠢的事情,但确实有可能发生。
看起来您还缺少 function.ts
的导入。
import { AzureFunction, Context, HttpRequest } from "@azure/functions";
关于node.js - 任何人都可以引导我朝着正确的方向让这个 Azure Functions 输出 "Cannot Find Module ' @azure/functions' 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65431913/
我正在尝试使用中介包在 R 中进行中介分析。我查看了有关如何执行此操作的文档,并通读了 R 提供的示例(即,我已经运行了“example(mediate)”)。尽管如此,我还是无法运行最简单的中介。理
我在我的应用程序中引导 View 时遇到问题。 我试图在 bootstrap 中获取 View 实例,以便我可以分配 View 变量等。 问题是我似乎无法按照推荐的方式来做。我可以做这个: $this
我已经遵循了几个有关运行 RMI 应用程序的教程。但是,我似乎无法使其工作,因为我一直陷入相同的错误:ClassNotFoundException。我知道这个错误意味着我将文件放在了错误的位置,但我尝
最后,我开始与 Aurelia 合作。有一个入门套件可用 Here这有助于初始化 Aurelia。但它是一个模板,应该在网站模板中使用。 我有一个预配置 WebApi项目,我想在其中使用 Aureli
对于回归问题,我有一个训练数据集: - 3个具有高斯分布的变量 - 20 个均匀分布的变量。 我的所有变量都是连续的,在 [0;1] 之间。 问题是用于对我的回归模型进行评分的测试数据对所有变量具有均
我正在尝试“拉伸(stretch)”或扩展第 1 列中的 A 部分以填充该行的高度。 1行2列: +---------------------+---------------------+ |
已关闭。此问题旨在寻求有关书籍、工具、软件库等的建议。不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以
我正在使用 bootstrap 4 填充功能。默认情况下,bootstrap4 中的 col 或 col-12 类在左右应用 15px 填充。我想为移动设备设置左右padding 0,所以我使用下面的
我正在尝试通过自己编写引导加载程序来引导 linux 内核,但不知道如何加载内核。 所有人都在说使用 int 13h 将扇区从硬盘加载到内存。 其中部门应该加载??加载扇区后怎么办? 如果可以的话,请
如何合并两者以创建垂直菜单?我有一个基本的路由设置(它可以工作并呈现为标准的水平菜单): Home Gallery Contact 从 react-bootst
我的应用程序中有一些状态来自服务器并且不会更改(在用户 session 的生命周期内)。此状态在 HTML 中引导。 我应该将它合并到 reducer 中作为商店的一部分吗?const bootstr
有没有办法使用 styled-components与 react-bootstrap 一起? React-bootstrap 为其组件公开了 bsClass 属性而不是 className ,这似乎与
除了 YouTube 播放器的大小之外,以下代码运行良好。我无法将其调整为我想要的大小。 我试着把 width="150"和 height="100"在 iframe 但什么也没发生。
我正在尝试使这个东西与 this one 相同。我已经打印了。但崩溃消耗不起作用。 @foreach($faqs as $faq)
我想在启动 Play 应用程序时运行一些代码。这似乎不起作用。有什么线索吗? public class Global extends GlobalSettings { @Override
我了解监督学习和无监督学习之间的区别: 监督学习是一种使用标记数据“教导”分类器的方法。 无监督学习让分类器“自行学习”,例如使用聚类。 但是什么是“弱监督学习”?它如何对示例进行分类? 最佳答案 更
我对 python 还是很陌生,所以请原谅我,如果这是非常简单的或非常错误的思考方式。 我安装了 python 2.7。根据我在运行以下代码时的理解,它列出了它查找模块的目录。 Python 2.7.
我想使用 bootstrap carousel 制作一个 slider ,但我的 slider 不滑动即使我点击按钮也不会滑动 我测试了很多其他的 bootstrap slider ,我也遇到了同样的
我正在尝试通过替换 base 形状为 (4,2) 的 2D numpy 数组按行进行采样,比如 10 次。最终输出应该是一个 3D numpy 数组。 尝试了下面的代码,它有效。但是有没有不用 for
我是 Bootstrap 的新手,现在我正在检查它的 slider 功能。简单的 slider 和动画效果 - 一切正常。 但是我看不懂,我可以做这样的东西吗? - http://www.owlcar
我是一名优秀的程序员,十分优秀!