簡體   English   中英

當我嘗試本教程時,React 不斷中止安裝

[英]React keeps aborting installation when I try the tutorial

我今天試圖按照 React 網站上的教程進行操作,但無論出於何種原因,當我運行命令時它都不想為我工作:

npx create-react-app my-app

`我收到以下錯誤消息;

Creating a new React app in D:\NodeJs\react\my-app.

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


npm ERR! code ETARGET
npm ERR! notarget No matching version found for postcss@^7.0.11
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'autoprefixer'
npm ERR! notarget

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\matth\AppData\Roaming\npm-cache\_logs\2019-01- 
12T17_55_39_805Z-debug.log

Aborting installation.
  npm install --save --save-exact --loglevel error react react-dom react- 
 scripts has failed.

Deleting generated file... package.json
Deleting my-app/ from D:\NodeJs\react
Done.`

我的npm版本是6.5.0,Node是11.6.0

不確定到底發生了什么,因為當我在我的工作筆記本電腦上執行此操作時,它在完全相同版本的節點和 npm 上沒有任何問題

當我錯誤create-react-app時,我正在解決問題

Err: code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in:

我重命名了文件.npmrc --> .npmrc-old

 C:\Users\you\.npmrc

我成功了 >>> 我感覺很完美

-

或者你能修復:--> 使用git bash終端

只是為大家更新。 它現在起作用了。 我所做的只是第四次重新安裝 nodejs,沒有別的。 0 有意義。 無論如何,感謝您的回答,謝謝。

我也遇到了同樣的錯誤。

嘗試運行 npm cache clean --force 然后運行 ​​create-react-app

肯定會奏效

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM