使用 uuidv4 时出现此错误。
Failure: Package subpath './v4' is not defined by "exports" in C:\Users\mycomp\Desktop\Programming\Javascript\Serverless\Serverless Framework\node_modules\uuid\package.json
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v4' is not defined by "exports" in C:\Users\mycomp\Desktop\Programming\Javascript\Serverless\Serverless Framework\node_modules\uuid\package.json
我已经安装了 uuid 并在我的代码中需要它
const uuidv4 = require('uuid/v4');
这是 package.json
"dependencies": {
"aws-sdk": "^2.702.0",
"moment": "^2.27.0",
"serverless-offline": "^6.4.0",
"underscore": "^1.10.2",
"uuid": "^8.1.0"
}
原文由 The One 发布,翻译遵循 CC BY-SA 4.0 许可协议
ECMAScript 模块语法:
CommonJS 语法: