• Node.js


    node中npm的使用
    nodejs 软件

    注:终端按两次Ctrl C 退出node

      node -v  查看node版本

      npm -v   看npm版本
    1.安装nodejs 自带了包管理器npm (node package manager)        

                  npm install Bootstrap

                    好比 Python 自带pip    pip install requests

    2.在终端进入当前项目目录,然后初始化目录,会生成一个package.json的文件来管理我们的包()模块(js)
                  npm init   简写为 npm i
                  npm i --yes 直接生成package.json

    {
          "name": "day50",
          "version": "1.0.0",
          "description": "",
          "main": "index.js",
          "scripts": {
                 "test": "echo "Error: no test specified" && exit 1"
          },
          "keywords": [],
          "author": "",
          "license": "ISC",
          "dependencies": {
                 "bootstrap": "^3.3.7",
                 "jquery": "^3.3.1"
           }
    }
    package.json示例


    3.下载当前项目依赖的包

                  npm install jquery@3.4.0 --save 或  npm install jquery@3.4.0 -S

                          自动生成 node_modules文件夹

                  注:从github上下载项目后,在终端cd到该项目目录,执行npm install     自动下载package.json中依赖的所有的包

                                                      卸载  npm uninstall jquery@3.4.0 --save 或  npm uninstall jquery@3.4.0 -S

    {
        "name": "happyfri",
        "version": "1.0.2",
        "description": "vue2-happyfri",
        "author": "cangdu <1264889788@qq.com>",
        "private": true,
        "scripts": {
            "dev": "node build/dev-server.js",
            "build": "node build/build.js"
        },
        "dependencies": {
            "vue": "^2.1.0",
            "vue-router": "^2.1.1",
            "vuex": "^2.0.0"
        },
        "devDependencies": {
            "autoprefixer": "^6.4.0",
            "autoprefixer-loader": "^3.2.0",
            "babel-core": "^6.0.0",
            "babel-loader": "^6.0.0",
            "babel-plugin-transform-runtime": "^6.0.0",
            "babel-preset-es2015": "^6.0.0",
            "babel-preset-stage-2": "^6.0.0",
            "babel-register": "^6.0.0",
            "babel-runtime": "^6.23.0",
            "chalk": "^1.1.3",
            "connect-history-api-fallback": "^1.1.0",
            "css-loader": "^0.25.0",
            "eventsource-polyfill": "^0.9.6",
            "express": "^4.15.3",
            "extract-text-webpack-plugin": "^1.0.1",
            "file-loader": "^0.9.0",
            "function-bind": "^1.0.2",
            "html-webpack-plugin": "^2.8.1",
            "http-proxy-middleware": "^0.17.2",
            "json-loader": "^0.5.4",
            "less": "^2.7.1",
            "less-loader": "^2.2.3",
            "opn": "^4.0.2",
            "ora": "^0.3.0",
            "semver": "^5.3.0",
            "shelljs": "^0.7.4",
            "style-loader": "^0.13.1",
            "url-loader": "^0.5.7",
            "vue-loader": "^10.0.0",
            "vue-style-loader": "^1.0.0",
            "vue-template-compiler": "^2.1.0",
            "webpack": "^1.13.2",
            "webpack-dev-middleware": "^1.8.3",
            "webpack-dev-server": "^1.16.2",
            "webpack-hot-middleware": "^2.12.2",
            "webpack-merge": "^0.14.1"
        },
        "engines": {
            "node": ">= 4.0.0",
            "npm": ">= 3.0.0"
        }
    }
    下载项目的package.json示例
    下载的包 是当前项目的依赖包
            如当前项目依赖 jquery + bootstrap
                npm i jquery --save
                npm i bootstrap --save
                    当前项目的依赖包
                    dependencies:{

                  "bootstrap": "^3.3.7",
                  "jquery": "^3.3.1"

                    }
                 压缩、丑陋化
                    
                 前端三大工具:
                        grant
                        gulp
                        webpack4.0
                 npm run dev
                    
                 npm  i webpack@4.0 --save-dev
                    开发环境下的依赖包
                    devDependencies:{

                  "webpack": "^1.13.2",
                  "webpack-dev-middleware": "^1.8.3",
                  "webpack-dev-server": "^1.16.2",
                  "webpack-hot-middleware": "^2.12.2",
                  "webpack-merge": "^0.14.1"

                    }




  • 相关阅读:
    Request Validation in ASP.NET
    ANSI、Unicode、Unicode big endian、UTF8编码
    在win7下安装SQL sever2005
    配置SQL Server 2005 以允许远程连接
    传统网站与Web标准——DIV+CSS布局实例
    打造自己的reset.css
    传统网站与Web标准——表格布局实例
    每天工作4小时的程序员
    良好的XHTML规则
    列表导航栏实例(02)——精美电子商务网站赏析
  • 原文地址:https://www.cnblogs.com/lbzbky/p/11790110.html
Copyright © 2020-2023  润新知