无法更新Cordova和Ionic

时间:2015-08-02 09:28:26

标签: cordova ionic-framework ionic

我无法将cordova更新为5.1.1,将Ionic更新为1.6.4。运行时

npm install -g cordova
没有任何反应。

运行时:

npm WARN engine npm@1.3.4: wanted: {"node":">=0.6","npm":"1"} (current: {"node":"0.12.7","npm":"2.7.3"})
npm WARN engine cordova-js@4.0.0: wanted: {"node":"~0.10.x"} (current: {"node":"0.12.7","npm":"2.7.3"})
npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"0.12.7","npm":"2.7.3"})
npm WARN installMany normalize-package-data was bundled with npm@1.3.4, but bundled package wasn't found in unpacked tree
/usr/bin/cordova -> /usr/lib/node_modules/cordova/bin/cordova
cordova@5.1.1 /usr/lib/node_modules/cordova
├── underscore@1.7.0
├── q@1.0.1
├── nopt@3.0.1 (abbrev@1.0.7)
└── cordova-lib@5.1.1 (valid-identifier@0.0.1, osenv@0.1.0, properties-parser@0.2.3, bplist-parser@0.0.6, mime@1.2.11, unorm@1.3.3, semver@2.1.0, shelljs@0.3.0, dep-graph@1.1.0, rc@0.5.2, npmconf@0.1.16, through2@0.6.3, xcode@0.6.7, elementtree@0.1.6, d8@0.4.4, request@2.47.0, tar@1.0.2, glob@4.0.6, cordova-registry-mapper@1.1.9, init-package-json@1.7.1, plist@1.1.0, cordova-app-hello-world@3.9.0, npm@1.3.4, cordova-js@4.0.0)

我得到:

Ionic CLI is out of date:
 * Locally installed version: 1.3.14
 * Latest version: 1.6.4
 * https://github.com/driftyco/ionic-cli/blob/master/CHANGELOG.md
 * Run npm install -g ionic to update

Ionic也提醒我更新:

cordova -v
4.3.0

但我不能这样做。

安装Cordova和Ionic之后我还有

ionic -v
1.3.14

  class RemoteDataTask extends AsyncTask<Void, Void, Void> {
    private UserDetailsActivity context;

    RemoteDataTask(UserDetailsActivity context) {
        this.context = context;
    }

    @Override
    protected void onPreExecute() {
        super.onPreExecute();;
        mProgressDialog = ProgressDialog.show(context, "Looking for posts", "Loading...", true, false);
    }

    @Override
    protected Void doInBackground(Void... params) {
        UserDetailsActivity.this.posts.clear();
        posts = new PostManager(context).userPosts(ParseUser.getCurrentUser());
        return null;
    }

    @Override
    protected void onPostExecute(Void result) {
        postList = (ListView) findViewById(R.id.post_list);
        adapter = new PostsListAdapter(context, UserDetailsActivity.this.posts);
        postList.setAdapter(adapter);
        mProgressDialog.dismiss();
    }
}

我该如何更新?

我正在运行Ubuntu 15.04。

2 个答案:

答案 0 :(得分:3)

确保安装了最新版本的node和npm。

然后尝试卸载cordova / ionic,然后重新安装。

请注意,使用npm update实际上并不更新节点包,而是更新该包中的node_modules。

答案 1 :(得分:3)

在许多地方提到的卸载和重新安装并不适合我。

所以我删除了目录&#39; cordova&#39;在:

/usr/local/lib/node_modules/
像这样:

sudo rm cordova -R   

然后:     npm install npm -g

然后:

sudo npm uninstall cordova -g

然后:

sudo npm install cordova -g

它有效。类似的方法也可以在Windows中使用