Ask coding questions

← Back to all posts
Why wont Node let me import things
h
AlmightyDeaks

Hi, I am trying to import a module to create a UUID but it just gives me an error. I am following this tutorial: https://www.devextent.com/npm-generate-unique-id/
i am fairly new to JavaScript but have never used node.js
if you know how to help please do

Answered by OldWizard209 [earned 5 cycles]
View Answer
Voters
AlmightyDeaks
Comments
hotnewtop
OldWizard209

Did you initiate npm(Node Package Manager). This will allow you to use packages. First you have to initialize npm. Write this in the shell.
npm init

Then install any package you want with in this case UUID:
npm install uuid

Then require it in your code:

AlmightyDeaks

@OldWizard209 Thank you so much

OldWizard209

no prablam @AlmightyDeaks