npm init react-app my-app和npx create-react-app my-app两个命令均不起作用

时间:2019-02-23 04:57:58

标签: reactjs npm yarnpkg npx

我是React的新手,并且想通过使用以下两个命令在Window 7机器上设置一个新的React应用:

npm init react-app my-app
npx create-react-app my-app

在运行npm和npx命令时,收到如下所述的错误。

E:\>npm init react-app my-app

Creating a new React app in E:\my-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

yarn add v1.13.0
[1/4] Resolving packages...
? reactassert.js:85
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: 2173 == 0
    at ClientRequest.onConnect (C:\Program Files (x86)\Yarn\lib\cli.js:140866:14
)
    at Object.onceWrapper (events.js:277:13)
    at ClientRequest.emit (events.js:189:13)
    at Socket.socketOnData (_http_client.js:475:11)
    at Socket.emit (events.js:189:13)
    at addChunk (_stream_readable.js:284:12)
    at readableAddChunk (_stream_readable.js:265:11)
    at Socket.Readable.push (_stream_readable.js:220:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts --cwd E:\my-app has failed.

Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting my-app/ from E:\
Done.

0 个答案:

没有答案