如何创建一个NodeJS项目

创建项目目录

mkdir EmojiImages

初始化

npm init

一直回车确认:

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 ` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (emojiimages)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /Users/diyuanwang/github/EmojiImages/package.json:

{
  "name": "emojiimages",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this OK? (yes)

这时候我们已经完成了nodejs项目的初始化工作。

我们得到了一个目录和一个文件EmojiImages/package.json
剩下的工作就是编写js文件了。

使用WebStorm 打开目录,并创建index.js

如何创建一个NodeJS项目_第1张图片

你可能感兴趣的:(如何创建一个NodeJS项目)