美文网首页
在Intelij idea 环境下搭建vue.js环境

在Intelij idea 环境下搭建vue.js环境

作者: 叶相依 | 来源:发表于2020-07-12 12:15 被阅读0次

    有道云笔记链接:

    在Intelij idea 环境下搭建vue.js环境

    Node.js和npm

    安装 Node.js 的时候会自动安装 npm ,并且 npm 就是 Node.js 的包管理工具(node package manager 的缩写)。

    参考:https://www.npmjs.com/about

    所以,安装Node.js默认就会安装npm,安装npm最简单的方式就是安装node。

    参考:https://docs.npmjs.com/downloading-and-installing-node-js-and-npm#using-a-node-installer-to-install-nodejs-and-npm

    安装Node一般使用2种安装方式,

    使用nvm(Node版本控制器 Node version manager)安装

    直接去官网下载Node.exe安装包,双击运行即可安装

    1.到nodejs下载官网下载安装nodejs

    建议使用左边推荐稳定版的。

    安装路径可以自行更改,如果为了省事,就默认c盘。如果更改,之后需要手动更改环境变量path

    对于Step 4 tools for Native Modules详解


    Tools for Native Modules Optionally install the tools necessary to compile native modules.
    Some npm modules need to compiled from C/C++ when instaling. If you want to be able to install such modules, some tools(Python2
    and Visual Studio Build Tools) need to be installed.
    Automatically install the necessary tools. Note that this will also install Chocolatey. The script will pop-up in a new window after the
    installation copletes.
    Alternatively, fllw the instructions at htps /github com/nodejs/node-gyp#on-windows to install the dependencies yourself
    .


    这是在告诉会给你自动安装2个工具:

    构建工具(Python 2和Visual Studio构建工具)

    Chocolatey

    构建工具是因为一些npm模块需要使用C/C++编译,如果想要编译这些模块,则需要安装这个工具。如果不安装这个构建工具,在之后使用 npm 安装模块的时候,会报错:

    如果见到这个错误,知道是因为没有安装 构建工具。构建工具和 Chocolatey 都是必装的,如果现在没有安装,可以之后再手动安装

    视频里的老师说,之后用到再装,但我为了省事,这里推荐直接勾选“Automatically install ...” ,然后 Next..

    剩下的就是Next到死

    查看是否安装完成

    方法1:安装完成后,查看安装目录,会发现目录下已经有我们安装的node和npm,具体:

    node.exe 我们需要的node

    npm 我们需要的npm

    npx npm的二进制文件执行工具

    node_modules 模块文件夹

    方法二:打开小黑窗输入node -v或者npm -v来获取当前版本号。若获取成功,就是安装完成

    错误:若出现‘npm’不是内部或外部命令,也不是可运行的程序

    则需要手动添加环境变量,一般若是默认安装路径,系统会自动添加环境变量

    操作方式:

    右键“我的电脑”

    选择“属性”

    在左侧栏选择“高级系统设置”

    选中选项卡“高级”

    点击右下角“环境变量(N)”

    系统环境变量(s) ,双击变量名为“path”哪一行,添加 自己的nodejs安装路径

    然后再打开 cmd 运行命令则一切正常。

    这样目前看来一切都正常了,不过我发现如果是 step 3 选择自动添加环境变量的话,在“{user}的用户变量(U)”,也会配置一个环境变量。

    双击“{user}的用户变量(U)”下的变量名为“Path”哪一行,添加值:

    C:\Users\{user}\AppData\Roaming\npm

    {user} 是你系统的当前用户名

    相关文章

      网友评论

          本文标题:在Intelij idea 环境下搭建vue.js环境

          本文链接:https://www.haomeiwen.com/subject/xepgcktx.html