npm create-react-app命令不适用于npm 6.9.0版本

时间:2019-09-12 19:15:01

标签: npm create-react-app

我以前已经成功使用过create-react-app,但是由于某种原因,它现在无法正常工作。我做了以下

npm install -g create-react-app
npm create-react-app test

但是以下内容代替了

Usage: npm <command>

where <command> is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    clean-install, clean-install-test, completion, config,
    create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
    edit, explore, get, help, help-search, hook, i, init,
    install, install-ci-test, install-test, it, link, list, ln,
    login, logout, ls, org, outdated, owner, pack, ping, prefix,
    profile, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, token, tst, un,
    uninstall, unpublish, unstar, up, update, v, version, view,
    whoami

npm <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview

Specify configs in the ini-formatted file:
    C:\Users\xxxxx\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@6.9.0 C:\Program Files\nodejs\node_modules\npm

有人知道发生了什么吗?

编辑:我成功了

 npx create-react-app test

但是,如果您知道npm为何无法运行,请提供帮助

1 个答案:

答案 0 :(得分:0)

npx带有 npm 5.2+和更高版本,请使用npx create-react-app test,它是您使用过的并且有效的!! 在第一种情况下,对于 npm 5.1或更早版本,您不能使用npx,而应使用 create-react-app test ,而无需使用npm < / p>

您也可以对更高版本的npm使用同一命令,并且应该没问题

这应该在您所在的目录中创建test应用。

如果您想使用npm,则可以执行npm init react-app test