我正在调用请求库const request = require("request")
我在 package.json 中添加了依赖项,我已发布以下错误。然而,通过阅读其他帖子,我意识到我可能需要 npm 安装请求模块并将整个 zip 作为文件夹导入。
由于我是节点新手,我想检查是否有另一种方法可以将“require”库导入当前工作目录,或者我是否在其他地方犯了错误?
这是我的 package.json:
{
"name": "fact",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"ask-sdk-core": "^2.0.0",
"ask-sdk-model": "^1.0.0",
"i18next": "^15.0.5",
"request": "^2.88.0"
}
}
Run Code Online (Sandbox Code Playgroud)
当我测试时它仍然给我以下错误:
Response:
{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module 'request'",
"trace": [
"Runtime.ImportModuleError: Error: Cannot find module 'request'",
" at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
" at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
" …Run Code Online (Sandbox Code Playgroud) if (abs(u) > Vdc)
u = Vdc*((u > 0) - (u < 0));
Run Code Online (Sandbox Code Playgroud)
这个代码在C中,考虑到我们输入if条件会发生什么?Vdc = 24; 考虑任何任意值的u来解释
我通过适用于 Windows 的 AWS 的 msi 安装程序安装了 AWS SAM。运行安装程序后,我sam --version在cmd和powershell中运行。
PS C:\Users\dgupta> sam --version
SAM CLI, version 1.26.0
Run Code Online (Sandbox Code Playgroud)
它返回我刚刚安装的版本。然而,在 VS Code 中,我打开了一个终端并运行sam --version它,结果出现错误。
PS C:\Users\dgupta> sam --version
SAM CLI, version 1.26.0
Run Code Online (Sandbox Code Playgroud)
为什么会发生这种情况?VS Code 终端和普通终端不能访问相同的环境变量吗?
windows powershell path-variables visual-studio-code aws-sam-cli