ADM-201 dump PMP dumps pdf SSCP exam materials CBAP exam sample questions

《网络忍者NodeJS入门》#2 Node.js安装 – 译学馆
未登录,请登录后再发表信息
最新评论 (0)
播放视频

《网络忍者NodeJS入门》#2 Node.js安装

Node JS Tutorial for Beginners #2 - Installing Node JS

嘿 伙计们好
Yo, what’s up today guys
欢迎来到第二个 Node.js 课程
Welcome to your second Node.js tutorial
本次视频我将给你展示我们如何安装Node.js
And in this video I’m going to show you how we can install Node.js
到我们的电脑上
On our computer
[开场音乐]
[intro music]
好的 那么第一件我们要做的事就是前往 nodejs.org
Alright then so, the first thing we want to do is head over to ‘nodejs.org’
我会把链接放在下面
I’ll leave the link down below
如果你想下载其中一个Nodejs版本到你的电脑上
And you want to download one of these versions of Node.js to your computer
你可以看到主页有两个选项
Now there’s two to choose from on the homepage
分别是4.4.4和6.2版本
There’s version 4.4.4 or 6.2
区别是 版本4在左边
And the difference is, that this 4 one, on the left
它是最新的稳定版本
Is the latest stable version
右边这个 它是拥有所有新特性的最新的版本
This one on the right, although it’s the latest version with all the new features
它可能不是很稳定
It may not be stable
对于你们大多数来说 我向你推荐左边这个
Ok, so for most of you, I’m going to suggest this one on the left
那么继续 点击并且下载到你的电脑上
So go ahead, click that and download it to your computer
安装时全部点击下一步
Go through the installation steps
不要改变任何东西 大概需要三分钟的时间
Don’t change anything, it will take you about three minutes
之后Node.js就会安装好啦
And then Node.js will be installed
我已经下载好这个版本 只是为了乐趣
I’ve already gone ahead and download this one, just for the fun of it
现在我们的电脑上已经安装好Node了
So, now that we’ve installed Node on our computer
我们怎么知道已经安装了呢
How do we actually know that it is installed?
你要做到的是 在下面搜索 cmd
Well, what you want to do is come down here, and search for ‘cmd’
就是那个弹出来的命令窗口
Which is going to bring up the command prompt
那么 在这 只需要写 “node -v”
And then, in here, just write ‘node space hyphen v’
它会告诉我们已经安装的Node是什么版本
And this is going to tell us what version of Node is installed
如果你已经成功安装Node
So if you’ve been successful in installing Node
它将会在这给你返回版本信息
Then it’s going to throw back the version there, to you
你可以看到我的是6.2 但是你的可能不同
You can see mine is 6.2, but yours might be different
就像我之前教程说的
Ok, so when I said in a previous tutorial that
我们要使用这个命令行
We’re going to be using the command line
我想说的是
This is what I meant
无论什么时候我们想运行一个Node应用程序
Whenever we want to run a Node application
或者在Node中做一些事
Or do something in Node
我们都会在这个命令行中会写一个命令
We’re going to write a command in this command line right here
但是我觉得这有点麻烦
But I find this a little bit cumbersome
因为我打算接下来的工作要在Atom中进行 这是个文本编辑器
Because I’m going to be working in Atom, this text editor
我不想一直在两个界面之前切换
And I don’t like constantly switching between the two
尽管它并不难
Although it’s not that hard
所以我要做的是在Atom中下载一个包
So what I’ve done is got ahead and downloaded a package
它给了我这个底部的终端
In Atom, which has given me this terminal at the bottom
那么我现在可以在这写Node命令
So now I can just write Node commands in here
而不用切换到这个东西
Instead of switching to this thing
懂了吗? 为了做到这样你要先到 “File”
Ok? So, to do that what you want to do is go to file
然后到 “Settings”
Then go to ‘Settings’
你可以到 “install” 来搜索这个终端
And you want to go to ‘Install’ to search for this terminal
现在我已经安装好了
Now I have already got it installed
我给你看一下这个叫什么
And I’m going to show you what that’s called
它叫做 “platformio-ide -terminal”
And it’s called, “platformio – ide – terminal’
所以只要搜索这个
So just search for this
在这个 install 部分
In the install section right here
然后安装到Atom
And then install in onto Atom
好现在我们已经完成了这些
Ok, so now that we’ve done that
我们可以在这写将要在另一个命令行中的做的任何东西
You’ll notice we can just write anything we would do in the other one
相当于把Node搬到这
For Node in here, instead
所以如果在这再次输入 “node -v”
So if I put ‘node hyphen v’ again, in here
按下 “enter” 键 它就会做同样的事情
Press ‘Enter’, it’s going to do the same thing
然后告诉我已经安装了6.2版本
And tell me I’ve got version 6.2 installed
嗯 酷
Ok, cool
所以 你已经注意到 在左边
So you’ll notice now, on the left
我已经打开了我上传到GitHub的文件
I’ve got open the files that I uploaded to GitHub
所以我下载好这些
So I downloaded those
并且在这右击
And then right clicked on here
到 “Add Project Folder”
Went to ‘Add Project Folder’
然后导航到从GitHub下载的文件那里
Then navigated to where I downloaded those files from GitHub
然后打开到Atom
And open them up into Atom
现在 我们已经取到这些公共文件夹和资产
So at the moment, we’ve got this public folder and the assets
这些都是为了之后的 “todo list”应用所准备的
And this all going to be for that todo list application we make later on
我们现在不会用到他们
We’re not going to use them just yet
但是我将要做的是来到顶部的文件夹然后导航到’new file’
But what I am going to do is come to the top folder and got a new file
我会新建一个名字叫做app .js的文件
And I’m going to create a new file called ‘app.js’
只是为了测试Node
Just to test out Node
然后在这里面 这儿 我会写 ‘console.log()’
And then inside here, I’m going to say ‘console.log()’
然后我会放一点信息 ‘hey ninjas’
And I’m just going to put a little message ‘hey ninjas’ in there, like that
然后保存
And save it
所以现在 如果我想在Node中运行这个应用或者这个文件
So now, if I want to run this application, or this file in Node
我该做什么
What do I do?
嗯 我切换到终端写下 ‘node’
Well I come down to the terminal, and I write ‘node’, space
那么 这个我想使用或者执行的
And then, the file name which I want to fire or execute
文件就是 ‘app.js’
Which is ‘app.js’
实际上我可以舍去 ‘.js’
And actually I can just leave off the ‘.js’
我可以只写 ‘app’ 即这个文件的名字
I can just put ‘app’, the name of the file
点击 ‘enter’ 然后它就会为你运行这个文件
Click ‘Enter’, and that going to run this file for you
然后你就会看到它已经把日志输出到了终端
And you’ll see that this is logged down here to the terminal
很棒 然而
Cool, however
为了做到这些 你会注意到我的终端在这个文件夹
To do this, you’ll notice I am in this directory in the terminal
‘node-js-playlist’
‘node-js-playlist’
在哪里创建文件 你就需要在哪儿运行
Where this file is found, so you’ll need to be there as well
无论文件在哪里 为了运行它 你需要在那儿
Wherever the file it found, to run it, you have to be there
或者给出这个文件的全部路径
Or, give the full path to the file
所以为了改变目录如果你在一个不同的目录
So, to change directory if you’re in a different directory in here
你只需要做 ‘cd’
You just do ‘cd’
为了进入上一级文件夹 你可以键入’..’
And to go up a directory, you do ‘.. (dot dot)’
这会把我带到上一个文件夹
That’s going to bring me up a directory
你看 它现在到了 YouTube sites 文件夹
You see, it’s gone to YouTube sites now
现在为了从你当前的目录回到你先前的目录
Now to go back into a directory that you’re currently in
你可以从当前的目录选择一个文件夹
Like to choose a folder from the directory you’re cul…currently in
你可以键入 ‘cd’
You say ‘cd’
然后 文件夹名
Then, the folder name
那么我可以键入 ‘node-js-playlist’
So I could say ‘node hyphen js hyphen playlist’
然后又回到了这个文件夹
And that’s going to go back into this folder
确保你所在的就是包含 ‘app.js’ 的文件夹
Ok, so make sure you’re in the folder where your ‘app.js’ is
然后用Node来运行它了
And then you can run it with Node app
就像这样 懂了吗?
Like so, ok?

Cool
截至目前我们已经成功的安装了Node
So, now we’ve successfully installed Node
并且我们已经运行了我们的的第一个Node应用 即使它相当简单
And we’ve ran our first Node application, even though it’s pretty pant
嗯 下节课我们就会讲一些高级的东西
Em, we’re going to move onto some move advanced stuff over the next few tutorials
在此之前 如果你有问题 你可以在下面留言
So until then, if you have any questions, leave those down below
不要忘了分享 订阅 和赞哦
Don’t forget to share, subscribe and like
下个视频见
And I’ll see you in the next video

发表评论

译制信息
视频概述

本次视频讲述了如何安装和运行你的第一个nodejs程序

听录译者

positiveme

翻译译者

【B】Cod

审核员

知易行难

视频来源

https://www.youtube.com/watch?v=1US-P13yKVs

相关推荐