简体   繁体   English

如何在ionic中使用package.json安装所有依赖项和插件

[英]How to install all the dependencies and plugins using package.json in ionic

I have cloned ionic project from git in which the node_modules, platforms, plugins are not available but in the package.json i am having all the detail so whether i have to install all one by one or is there any short way where i can use the package.json and install all the node_modules, platforms and plugins. 我从git中克隆了离子项目,其中node_modules,平台,插件不可用但在package.json中我有所有细节,所以我是否必须逐个安装或者有任何简短的方法我可以使用package.json并安装所有node_modules,平台和插件。

package.json 的package.json

{
    "private": true,
    "engines": {
        "node": ">=4.0.0"
    },
    "scripts": {
        "test": "gulp build --minify && gulp karma"
    },
    "devDependencies": {
        "browser-sync": "^2.8.3",
        "chalk": "^1.1.0",
        "cordova": "^6.0.0",
        "del": "^2.0.0",
        "elementtree": "^0.1.6",
        "eslint": "^3.0.0",
        "gulp": "^3.9.1",
        "gulp-angular-filesort": "^1.1.1",
        "gulp-autoprefixer": "^3.0.1",
        "gulp-changed": "^1.3.0",
        "gulp-csso": "^2.0.0",
        "gulp-eslint": "^3.0.0",
        "gulp-filter": "^4.0.0",
        "gulp-htmlmin": "^2.0.0",
        "gulp-if": "^2.0.0",
        "gulp-imagemin": "^3.0.1",
        "gulp-inject": "^4.0.0",
        "gulp-jsonlint": "^1.1.0",
        "gulp-load-plugins": "^1.0.0-rc",
        "gulp-natural-sort": "^0.1.0",
        "gulp-ng-annotate": "^2.0.0",
        "gulp-plumber": "^1.0.1",
        "gulp-protractor": "^3.0.0",
        "gulp-rename": "^1.2.2",
        "gulp-sass": "^3.1.0",
        "gulp-shell": "^0.5.1",
        "gulp-size": "^2.0.0",
        "gulp-sourcemaps": "^1.5.2",
        "gulp-uglify": "^2.0.0",
        "gulp-useref": "^3.0.4",
        "karma": "^1.1.0",
        "karma-angular-filesort": "^1.0.0",
        "karma-jasmine": "^1.0.2",
        "karma-ng-html2js-preprocessor": "^1.0.0",
        "karma-phantomjs-launcher": "^1.0.0",
        "lodash": "^4.3.0",
        "main-bower-files": "^2.9.0",
        "minimist": "^1.2.0",
        "phantomjs-prebuilt": "^2.1.4",
        "plist": "git://github.com/akofman/plist.js.git#3f256fd21ab3ad3ada0f491cfc905098a2631342",
        "proxy-middleware": "^0.15.0",
        "require-dir": "^0.3.0",
        "vinyl-paths": "^2.0.0",
        "wiredep": "^4.0.0",
        "xml2js": "^0.4.9",
        "yeoman-test": "^1.1.0"
    },
    "generator-m-ionic": {
        "proxies": [
            {
                "proxyMapFrom": "/postman-proxy",
                "proxyMapTo": "https://echo.getpostman.com"
            },
            {
                "proxyMapFrom": "/another-proxy",
                "proxyMapTo": "https://echo.getpostman.com"
            }
        ]
    },
    "dependencies": {
        "angular-multiple-select": "^1.1.2",
        "cordova-android": "^6.2.3",
        "cordova-ios": "~4.3.1",
        "cordova-plugin-device": "~1.1.5",
        "cordova-plugin-network-information": "~1.3.2",
        "cordova-plugin-whitelist": "1",
        "cordova-plugin-x-toast": "~2.6.0",
        "ionic-plugin-keyboard": "~2.2.1",
        "pdfmake": "^0.1.31"
    },
    "cordova": {
        "plugins": {
            "cordova-plugin-x-toast": {},
            "cordova-plugin-device": {},
            "cordova-plugin-network-information": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {}
        },
        "platforms": [
            "android",
            "ios"
        ]
    }
}

First install both ionic and cordova cli.(It is an ionic v1 project with android/ios platforms) from your package.json. 首先从package.json安装ionic和cordova cli(这是一个带有android / ios平台的离子v1项目)。

npm i -g cordova ionic

To install dependencies and devDependencies, do: 要安装依赖项和devDependencies,请执行以下操作:

npm install

To install plugins and platforms as per package.json, 要按照package.json安装插件和平台,

ionic cordova prepare

You may use the npm install command, which will install all of the project dependencies locally. 您可以使用npm install命令,该命令将在本地安装所有项目依赖项。

npm official docs description for npm install command: npm官方文档描述npm install命令:

This command installs a package, and any packages that it depends on. 此命令将安装程序包及其依赖的任何程序包。 If the package has a package-lock or shrinkwrap file, the installation of dependencies will be driven by that, with an npm-shrinkwrap.json taking precedence if both files exist. 如果软件包具有package-lock或shrinkwrap文件,则依赖项的安装将由此驱动,如果两个文件都存在,则npm-shrinkwrap.json优先。 See package-lock.json and npm-shrinkwrap. 请参阅package-lock.json和npm-shrinkwrap。

source 资源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM