Manage packages with npm/ start a project

Manage packages with npm/ start a project
0.0 0

#1

after i type in npm init --scope=username, the computer prints out
"This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See npm help json for definitive documentation on these fields
and exactly what they do.
Use npm install <pkg> --save afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit."

what am i suppose to type? I tried npm help json but i get
Sorry, name can only contain URL-friendly characters.

Also what is the pkg in npm install pkg --save


#2

pkg is the name of the package,
also, check your browser after entering npm help json.
i was directed to file:///C:/Program%20Files/nodejs/node_modules/npm/html/doc/files/package.json.html , a documentation page.


#3

When you run npm init it creates a package.json file with basic info about your project.

You can just click “Enter” to every request and don’t type anything or you can run npm init -y and it will create a package.json file without asking you anything (you can afterwards edit that file manually).

Also what is the pkg in npm install pkg --save

pkg is the name of the package you want to install.
For example to install React you type:

npm install --save react

or shorter version:

npm i -S react

#4

After I type in npm help json i get this

NAME
package.json - Specifics of npm’s package.json handling
DESCRIPTION
This document is all you need to know about what’s required in your package.json file. It must be actual JSON, not
just a JavaScript object literal.
A lot of the behavior described in this document is affected by the config settings described in npm help 7 npm-con‐
fig.
name
The most important things in your package.json are the name and version fields. Those are actually required, and
your package won’t install without them. The name and version together form an identifier that is assumed to be
Manual page package.json(5) line 1 (press h for help or q to quit)

I don’t know what you’re saying about the browser part? I 'm doing this on nitrous.io


#5

That’s not important.I was doing this locally and I didn’t understand what was your problem… @jenovs already explained.


#6

Thank you! I was stuck on that for awhile and googled for solutions. You are the only person who said to click “Enter”.