我正在尝试安装react-native-cli但出现错误
npm install -g react-native-cli
遇到此错误
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'react-native-cli' ]
2 info using npm@6.4.1
3 info using node@v10.15.0
4 verbose npm-session 72c72ae6cf674a04
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 http://registry.npmjs.org/react-native-cli 247ms
8 silly fetchPackageMetaData error for react-native-cli@latest Unexpected token < in JSON at position 0 while parsing near '<HTML><HEAD>
8 silly fetchPackageMetaData <meta h...'
9 timing stage:rollbackFailedOptional Completed in 1ms
10 timing stage:runTopLevelLifecycles Completed in 568ms
11 verbose stack SyntaxError: Unexpected token < in JSON at position 0 while parsing near '<HTML><HEAD>
11 verbose stack <meta h...'
11 verbose stack at JSON.parse (<anonymous>)
11 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
11 verbose stack at consumeBody.call.then.buffer (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50)
11 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7)
12 verbose cwd C:\Users\Basva
13 verbose Windows_NT 10.0.17134
14 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "react-native-cli"
15 verbose node v10.15.0
16 verbose npm v6.4.1
17 error Unexpected token < in JSON at position 0 while parsing near '<HTML><HEAD>
17 error <meta h...'
18 verbose exit [ 1, true ]
怎么了.. !!!?
答案 0 :(得分:0)
请确保您的npm软件包是否正确安装。我按照以下步骤解决了此问题。请尝试一下。
我认为https://facebook.github.io/react-native/docs/getting-started.html对您更有用。