Mahendra Verma
Mahendra Verma

Reputation: 31

React.js: create-react-app working but returns this type of error

I'm new to React and I used this explanation to build a basic React app:

when i try to create new react app by using

npm create-react-app trail-app

then it's returns

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

[email protected] C:\Program Files\nodejs\node_modules\npm

so how i can fix it.

Upvotes: 0

Views: 2751

Answers (4)

Mahendra Verma
Mahendra Verma

Reputation: 31

It's version "webpack" problem.


It needs to install verion "webpack" "4.19.1" so

firstly we have to uninstall our old version "webpack" by using

$npm uninstall -g webpack

and then install new version "webpack" "4.19.1" by using

$npm install -g [email protected]

Thank You

Upvotes: 2

stress_tn
stress_tn

Reputation: 174

If you want to use npm, so you need to do this: npm init react-app my-app Check documentation: https://github.com/facebook/create-react-app

Upvotes: 0

dubes
dubes

Reputation: 5504

Ayushyas answer using npx is the recommended one, but requires npm version 5.1 or higher. For npm version 5.0 or lower, you need to follow the following steps:

# 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

For npm v6 or higher, you can also use the npm init command

npm init react-app my-app

As always, the best place to look for such nuances is their official docs

Upvotes: 0

Ayushya
Ayushya

Reputation: 1920

Use npx create-react-app trail-app

Upvotes: 0

Related Questions