我正在尝试通过使用Expo来学习React Native(一般来说,我是相当陌生的编程人员)。我遵循了我可以从Expo文档和有用的视频中找到的所有设置说明,但是我仍然遇到以下错误。我已经使用Nodejs v12.13和v13进行了尝试(因为有警告,尽管它是当前版本,但它不支持v13)。我尝试搜索,发现了类似的问题,但是没有一种解决方案对我有用。我觉得我在某个地方遗漏了一个简单,关键的错误,希望得到一些帮助!
我在Windows 10上|世博会v3.4.1 | Nodejs v12.13(尽管尝试使用当前版本v13会产生相同的错误) npm v6.12
我按照世博会网站上的步骤开始:
安装NodeJS
在CMD中(以管理员身份运行),安装Expo npm install expo-cli --global
expo init rn-first-app
cd rn-first-app
npm start
Expo按预期在浏览器中打开一个页面,并且在崩溃/退出之前始终持续约1-3秒,并且我收到以下错误消息:
c:\Users\Michael\Documents\rn-first-app>npm start
> @ start c:\Users\Michael\Documents\rn-first-app
> expo start
Starting project at c:\Users\Michael\Documents\rn-first-app
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
error Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class. Run CLI with --verbose flag for more details.
Metro Bundler process exited with code 1
Set EXPO_DEBUG=true in your env to view the stack trace.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Michael\AppData\Roaming\npm-cache\_logs\2019-10-23T09_36_05_806Z-debug.log
在下面,我将添加更多错误日志,以防发现问题:
有详细标志:
c:\Users\Michael\Documents\rn-first-app>npm start --verbose
npm info it worked if it ends with ok
npm verb cli [
npm verb cli 'C:\\Windows\\System32\\nodejs\\node.exe',
npm verb cli 'C:\\Users\\Michael\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli 'start',
npm verb cli '--verbose'
npm verb cli ]
npm info using npm@6.12.0
npm info using node@v12.13.0
npm verb run-script [ 'prestart', 'start', 'poststart' ]
npm info lifecycle @~prestart: @
npm info lifecycle @~start: @
> @ start c:\Users\Michael\Documents\rn-first-app
> expo start
Starting project at c:\Users\Michael\Documents\rn-first-app
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
error Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class. Run CLI with --verbose flag for more details.
Metro Bundler process exited with code 1
Set EXPO_DEBUG=true in your env to view the stack trace.
npm verb lifecycle @~start: unsafe-perm in lifecycle true
npm verb lifecycle @~start: PATH: C:\Users\Michael\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;c:\Users\Michael\Documents\rn-first-app\node_modules\.bin;C:\Python27\;C:\Python27\Scripts;C:\Program Files\Oculus\Support\oculus-runtime;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\PowerShell\6\;C:\ProgramData\chocolatey\bin;C:\Program Files\Java\jdk1.8.0_221\bin;C:\Program Files\Git\cmd;C:\Windows\System32\nodejs\;C:\Users\Michael\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\Michael\AppData\Local\Programs\Python\Python36\;C:\Users\Michael\AppData\Local\Microsoft\WindowsApps;C:\Users\Michael\AppData\Roaming\npm
npm verb lifecycle @~start: CWD: c:\Users\Michael\Documents\rn-first-app
npm info lifecycle @~start: Failed to exec start script
npm verb stack Error: @ start: `expo start`
npm verb stack Exit status 1
npm verb stack at EventEmitter.<anonymous> (C:\Users\Michael\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
npm verb stack at EventEmitter.emit (events.js:210:5)
npm verb stack at ChildProcess.<anonymous> (C:\Users\Michael\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
npm verb stack at ChildProcess.emit (events.js:210:5)
npm verb stack at maybeClose (internal/child_process.js:1021:16)
npm verb stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
npm verb pkgid @
npm verb cwd c:\Users\Michael\Documents\rn-first-app
npm verb Windows_NT 10.0.18362
npm verb argv "C:\\Windows\\System32\\nodejs\\node.exe" "C:\\Users\\Michael\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start" "--verbose"
npm verb node v12.13.0
npm verb npm v6.12.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
npm timing npm Completed in 6306ms
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Michael\AppData\Roaming\npm-cache\_logs\2019-10-23T09_39_16_976Z-debug.log
和错误日志:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Windows\\System32\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Michael\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start',
1 verbose cli '--verbose'
1 verbose cli ]
2 info using npm@6.12.0
3 info using node@v12.13.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle @~prestart: @
6 info lifecycle @~start: @
7 verbose lifecycle @~start: unsafe-perm in lifecycle true
8 verbose lifecycle @~start: PATH: C:\Users\Michael\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;c:\Users\Michael\Documents\rn-first-app\node_modules\.bin;C:\Python27\;C:\Python27\Scripts;C:\Program Files\Oculus\Support\oculus-runtime;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\PowerShell\6\;C:\ProgramData\chocolatey\bin;C:\Program Files\Java\jdk1.8.0_221\bin;C:\Program Files\Git\cmd;C:\Windows\System32\nodejs\;C:\Users\Michael\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\Michael\AppData\Local\Programs\Python\Python36\;C:\Users\Michael\AppData\Local\Microsoft\WindowsApps;C:\Users\Michael\AppData\Roaming\npm
9 verbose lifecycle @~start: CWD: c:\Users\Michael\Documents\rn-first-app
10 silly lifecycle @~start: Args: [ '/d /s /c', 'expo start' ]
11 silly lifecycle @~start: Returned: code: 1 signal: null
12 info lifecycle @~start: Failed to exec start script
13 verbose stack Error: @ start: `expo start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Michael\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:210:5)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\Michael\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:210:5)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid @
15 verbose cwd c:\Users\Michael\Documents\rn-first-app
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Windows\\System32\\nodejs\\node.exe" "C:\\Users\\Michael\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start" "--verbose"
18 verbose node v12.13.0
19 verbose npm v6.12.0
20 error code ELIFECYCLE
21 error errno 1
22 error @ start: `expo start`
22 error Exit status 1
23 error Failed at the @ start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
非常感谢您的帮助!