How to install the express in Ubuntu via npm?

Asked

Viewed 117 times

0

When I try to install the Express in the Ubuntu, with the command npm install express, this error occurs:

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

    Try first npm init, to create the . json that identifies the packages to be installed. Then npm install express --save

  • You want to install only within a project or global?

  • I want to install global

2 answers

2

It looks like you are trying to install the package within a Node project and not globally in the OS. To do this you can use the following command:

npm install -g express@latest

If there is a package.json in the local directory, where you are running the command, you can simply use:

npm install express

or

npm install express --save-dev if it is a development-only dependency, which in the case of Express I believe is not.

1

First create a new project using the "npm init" command. This will create a file called "package.json" in your folder. Then use the command "npm install express --save" ("--save" if you want to save the express as a dependency of your project).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.