小编Tom*_*one的帖子

How to use nanoid module on NodeJS?

I know that maybe this question is very silly, but I can't make nanoid to work on my NodeJS app.

I already read the docs.

This is my app.js configuration:

var nanoid = require("nanoid");
var ID = nanoid();
Run Code Online (Sandbox Code Playgroud)

And I get the error message:

TypeError: nanoid is not a function
  at Object.<anonymous> (myapp.js directory)
Run Code Online (Sandbox Code Playgroud)

Maybe I need to import the function inside nanoid but I dont know how to do it. Help would be appreciate. Thanks.

javascript module mongoose mongodb node.js

8
推荐指数
1
解决办法
4499
查看次数

标签 统计

javascript ×1

module ×1

mongodb ×1

mongoose ×1

node.js ×1