【问题标题】:create-react-app: Issue with first command using npmcreate-react-app:使用 npm 的第一个命令出现问题
【发布时间】:2019-03-25 09:27:25
【问题描述】:

我想使用 npm 创建-react-app。我尝试关注此链接https://reactjs.org/docs/create-a-new-react-app.html

我尝试在我的 commond propmt 中运行“npx create-react-app my-app”命令,但它给了我错误。

0 信息如果它以 ok 结尾,它就会起作用
1 详细的 cli ['C:\Program Files\nodejs\node.exe',
1 详细的 cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 详细的 cli '安装',
1 详细的 cli '-g',
1 详细的 cli 'create-react-app' ]
2 使用 npm@6.4.1 的信息
3 使用 node@v8.12.0 的信息
4 详细的 npm-session 1bc5fca63b5e4cf5
5傻装loadCurrentTree
6傻安装readGlobalPackageData
7 详细堆栈类型错误:asyncWrite 不是函数
7 写入时的详细堆栈 (C:\Program Files\nodejs\node_modules\npm\node_modules\readable-stream\lib_stream_writable.js:480:
7)
WritableState.onwrite 的 7 个详细堆栈(C:\Program Files\nodejs\node_modules\npm\node_modules\readable-stream\lib_stream_writable.js:180:5)
WriteStream.to [as _worker] 上的 7 个详细堆栈(C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\cache.js:154:13)
WriteStream._write 的 7 个详细堆栈(C:\Program Files\nodejs\node_modules\npm\node_modules\mississippi\node_modules\flush-write-stream\index.js:35:13)
doWrite 的 7 个详细堆栈 (C:\Program Files\nodejs\node_modules\npm\node_modules\readable-stream\lib_stream_writable.js:428:64)
writeOrBuffer 处的 7 个详细堆栈 (C:\Program Files\nodejs\node_modules\npm\node_modules\readable-stream\lib_stream_writable.js:
417:5)
WriteStream.Writable.write 的 7 个详细堆栈(C:\Program Files\nodejs\node_modules\npm\node_modules\readable-stream\lib_stream_writable.js:334:11)
WriteStream.to [as _worker] 上的 7 个详细堆栈(C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\cache.js:
171:25)
WriteStream._write 的 7 个详细堆栈(C:\Program Files\nodejs\node_modules\npm\node_modules\mississippi\node_modules\flush-write-stream\index.js:35:13)
doWrite 的 7 个详细堆栈 (C:\Program Files\nodejs\node_modules\npm\node_modules\readable-stream\lib_stream_writable.js:428:64)
writeOrBuffer 处的 7 个详细堆栈 (C:\Program Files\nodejs\node_modules\npm\node_modules\readable-stream\lib_stream_writable.js:
417:5)
WriteStream.Writable.write 的 7 个详细堆栈(C:\Program Files\nodejs\node_modules\npm\node_modules\readable-stream\lib_stream_writable.js:334:11)
WriteStream.to [as _worker] 上的 7 个详细堆栈(C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\cache.js:182:19)
WriteStream._write 的 7 个详细堆栈(C:\Program Files\nodejs\node_modules\npm\node_modules\mississippi\node_modules\flush-write-stream\index.js:35:13)
doWrite 的 7 个详细堆栈 (C:\Program Files\nodejs\node_modules\npm\node_modules\readable-stream\lib_stream_writable.js:428:64)
writeOrBuffer 处的 7 个详细堆栈 (C:\Program Files\nodejs\node_modules\npm\node_modules\readable-stream\lib_stream_writable.js:417:5)
8 详细 cwd E:\xampp\htdocs
9 详细 Windows_NT 10.0.17134
10 详细 argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "create-反应应用程序”
11详细节点v8.12.0
12 详细 npm v6.4.1
13 错误 asyncWrite is not a function
14 详细退出 [ 1, true ]

我也尝试缓存清理并应用替代方式来运行此命令“npm install -g create-react-app”,但仍然没有解决我的问题。

我的node版本是v8.12.0,npm版本是6.4.1

【问题讨论】:

  • 将您的错误发布为文本,而不是图像。
  • @KalpeshPrajapati 将错误粘贴到代码块中很重要,因为它使试图帮助您的人的生活更轻松,并且让其他分享您的问题的人更容易搜索您的问题。有关更多详细信息,请阅读 this。此外,解雇那些试图帮助你的人并不是解决问题的好方法。

标签: node.js reactjs npm node-modules npm-start


【解决方案1】:

您似乎遇到了npx bug #100 - 您的目录名称中有一个空格。在修复该错误之前,解决方法是先执行npm cache clean,然后执行npm install -g create-react-app。然后你原来的 npx 命令应该可以工作了。

【讨论】:

    猜你喜欢
    • 2020-05-11
    • 1970-01-01
    • 1970-01-01
    • 2021-04-28
    • 2017-02-09
    • 2020-04-19
    • 2022-10-01
    • 2020-08-11
    • 2021-08-10
    相关资源
    最近更新 更多