【发布时间】:2020-04-03 10:16:04
【问题描述】:
在JS中安装npm uuid后,我无法调用uuid函数,使用electron
这是我安装时终端上的消息,我不知道这是否正确安装
$ npm install uuid
npm WARN pemrograman_visual2@1.0.0 No description
npm WARN pemrograman_visual2@1.0.0 No repository field.
+ uuid@7.0.3
updated 1 package and audited 120 packages in 1.746s
2 packages are looking for funding
run `npm fund` for details
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
这是我调用函数的地方
ipcMain.on("appointment:create", (event, appointment) => {
appointment["id"] = uuid();
appointment["done"] = 0;
allAppointment.push(appointment);
CreateWindow.close();
console.log(allAppointment);
});
但是当我使用 $npm start 运行程序时,它显示 TypeError: uuid is not a function
【问题讨论】:
-
你是不是像
const uuid = require('uuid').v4;一样导入了? -
是的,我像这样导入它
const uuid = require("uuid");
标签: javascript node.js electron uuid