0

I need to use npm to install packages redis & moment on my system but it's not happening, I'm getting this instead:

$ npm install redis;npm install moment
/home/ron
└─┬ redis@2.8.0 
  ├── double-ended-queue@2.1.0-0 
  ├── redis-commands@1.4.0 
  └── redis-parser@2.6.0 

npm WARN enoent ENOENT: no such file or directory, open '/home/ron/package.json'
npm WARN ron No description
npm WARN ron No repository field.
npm WARN ron No README data
npm WARN ron No license field.
/home/ron
├── moment@2.22.2 
└── redis@2.8.0 

npm WARN enoent ENOENT: no such file or directory, open '/home/ron/package.json'
npm WARN ron No description
npm WARN ron No repository field.
npm WARN ron No README data
npm WARN ron No license field.

and I've tried with sudo too but got the same result... How do I fix this?

0

You forgot to run npm init. You have to create package.json file first.

You can find more details here: https://docs.npmjs.com/creating-a-package-json-file

1

Have you created a package.json file? Maybe I Think run this command first again.

LPB_Tandn_IT:~ tannetto$ npm init

This is command creates a package.json file in your folder.

Then run,

LPB_Tandn_IT:~ tannetto$ npm install redis --save

The --save ensures your module is saved as a dependency in your package.json file.

I hope you will find this article useful and this works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.