npm - `npm create-react-app` 命令不适用于 npm 版本 6.9.0
问题描述
我之前已经成功使用过 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 不起作用,请提供帮助
解决方案
npx
附带npm 5.2+ 和更高版本,使用npx create-react-app test
你使用的,它工作!在第一种情况下,对于npm 5.1 或更早版本,您不能使用npx
,您应该使用create-react-app test而不使用npm
您也可以使用更高版本的相同命令,npm
应该没问题
这应该test
在您所在的目录中创建应用程序。
如果你想使用npm
,你可以做npm init react-app test
推荐阅读
- email - Google Analytics - 电子邮件跟踪链接点击 - 如何在同一视图中查看所有自定义活动数据(“发送”、“打开”、“点击”)
- python - LSTM,多二进制数组输入和过拟合处理
- php - JQuery 特定问题 - PHP JSON 返回
- python - Python OpenCV VideoCapture read() 无法读取帧
- c - 在 Visual Studio 和 C 项目上运行之间的不一致
- data-mining - 数据挖掘,维度灾难
- testing - 开玩笑未解决的承诺不会失败
- swift - 在 react-native 和 swift 之间共享 cookie
- angular - 角度嵌套模型驱动的反应形式选择选项发布请求不起作用
- java - 如何使用 Android MediaPlayer 播放视频流?FileDescriptor,Uri,Path,MediaDataSource?