Home > other >  Why am I getting an error when trying to install and run npm?
Why am I getting an error when trying to install and run npm?

Time:09-26

I am trying to install and run npm in a linux environment. I have executed the below code to try and achieve this

nvm install v11.0.0
nvm use v11.0.0
npm install
npm start

When I execute npm install in the command line I keep getting the following error message. Any advice to help this run is much appreciated.

npm WARN saveError ENOENT: no such file or directory, open '/home/andrewoca/PycharmProjects/pythonProject/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/andrewoca/PycharmProjects/pythonProject/package.json'
npm WARN pythonProject No description
npm WARN pythonProject No repository field.
npm WARN pythonProject No README data
npm WARN pythonProject No license field.

CodePudding user response:

npm install is looking for package.json in order to see what it needs to do. Since you dont have it - you get the errors.

See https://docs.npmjs.com/cli/v7/commands/npm-install

CodePudding user response:

Try to use sudo before npm install

CodePudding user response:

Before running npm install, create an npm project.

This can be done with npm init -y

Now you can use npm install <package name>

  • Related