• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

如何创建一个node项目?

nodejs 程序猿 4年前 (2021-12-27) 37次浏览 已收录 0个评论

创建一个node项目的方法:使用命令mkdir EmojiImages创建一个项目,使用命令npm init然后一直回车完成初始化,最后在EmojiImages目录中编写js文件就可以了。

创建一个node项目的方法步骤:

创建项目目录

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 <pkg>` 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": &quo<a style="color:transparent">来源gao*daima.com搞@代#码网</a>t;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

以上就是如何创建一个node项目?的详细内容,更多请关注gaodaima搞代码网其它相关文章!


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:如何创建一个node项目?

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址