我是React的新手,我用以下解释来构建基本的React应用:
当我尝试使用创建新的React应用时
npm create-react-app trail-app
然后返回
D:\sws projects\reactApp>
D:\sws projects\reactApp>npm create-react-app trail-app
Usage: npm <command>
where <command> is one of:
access, adduser, audit, bin, bugs, c, cache, ci, cit,
completion, config, create, ddp, dedupe, deprecate,
dist-tag, docs, doctor, edit, explore, get, help,
help-search, hook, i, init, install, install-test, it, link,
list, ln, login, logout, ls, 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\Mahendra\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm@6.4.1 C:\Program Files\nodejs\node_modules\npm
那么我该如何解决。
答案 0 :(得分:0)
使用
npx create-react-app trail-app
答案 1 :(得分:0)
推荐使用npx
的Ayushyas答案,但要求使用npm 5.1或更高版本。
对于npm 5.0或更低版本,您需要执行以下步骤:
# install globally so that you can use the create-react-app in command line
npm install -g create-react-app
# use the newly installed create-react-app to create your app, note, no need to use npm here
create-react-app my-app
对于npm v6或更高版本,您还可以使用npm init
命令
npm init react-app my-app
一如既往,寻找这种细微差别的最佳地方是他们的官方docs
答案 2 :(得分:0)
如果要使用npm,则需要执行以下操作: npm init react-app我的应用 查看文档:{{3}}
答案 3 :(得分:0)
因此需要安装版本“ webpack”“ 4.19.1”
首先,我们必须通过使用
卸载旧版本的“ webpack”,然后使用
安装新版本“ webpack”“ 4.19.1”