[英]Getting Error: Cannot find module 'js-yaml'
I have installed js-yaml
with this command我已经用这个命令安装了
js-yaml
npm i @types/js-yaml
And my package.json
looks like this我的
package.json
看起来像这样
"dependencies": {
"@types/js-yaml": "^4.0.5",
"aws-cdk-lib": "2.20.0",
"constructs": "^10.0.0",
"source-map-support": "^0.5.16",
"ts-sync-request": "^1.4.1"
}
And my code doesn't show any error in vscode
而且我的代码在
vscode
中没有显示任何错误
import * as yml from 'js-yaml';
...
const metricsServerManifestUrl = 'https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml';
const manifest = yml.loadAll(new SyncRequestClient().get(metricsServerManifestUrl));
cluster.addManifest('metrics-server', manifest);
But I'm getting this error when I try to run application但是当我尝试运行应用程序时出现此错误
Error: Cannot find module 'js-yaml'
错误:找不到模块“js-yaml”
How can I fix this?我怎样才能解决这个问题?
The @types/js-yaml
contains only type definitions used by TypeScript compiler to verify your code. @types/js-yaml
仅包含 TypeScript 编译器用于验证您的代码的类型定义。 However, it doesn't contain the actual implementation required at runtime.但是,它不包含运行时所需的实际实现。
You should install npm install js-yaml --save
.您应该安装
npm install js-yaml --save
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.