首页 > 解决方案 > React Native 项目由于错误而无法启动:EISDIR

问题描述

初学者在这里反应本地用户。

我尝试按照Mosh关于 React Native 的指南进行操作,但是当我运行 npm start 命令时,我在终端中收到此错误:

Opening DevTools in the browser... (press shift-d to disable)
error EISDIR: illegal operation on a directory, read.

Error: EISDIR: illegal operation on a directory, read
Metro Bundler process exited with code 1
Error: Metro Bundler process exited with code 1
    at ChildProcess.<anonymous> (C:\@expo\xdl@57.9.35\src\Project.ts:1917:16)
    at Object.onceWrapper (events.js:422:26)
    at ChildProcess.emit (events.js:315:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
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\steve\AppData\Roaming\npm-cache\_logs\2020-09-04T16_22_24_340Z-debug.log

这是详细的日志:

0 info it worked if it ends with ok
1 verbose cli [
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   'run',
1 verbose cli   'web'
1 verbose cli ]
2 info using npm@6.14.6
3 info using node@v12.18.3
4 verbose run-script [ 'preweb', 'web', 'postweb' ]
5 info lifecycle @~preweb: @
6 info lifecycle @~web: @
7 verbose lifecycle @~web: unsafe-perm in lifecycle true
8 verbose lifecycle @~web: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\steve\MyApp\node_modules\.bin;C:\Python38\Scripts\;C:\Python38\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Git\cmd;C:\Program Files (x86)\Brackets\command;C:\Program Files\dotnet\;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Users\steve\AppData\Local\Microsoft\WindowsApps;;C:\Users\steve\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\steve\.dotnet\tools;C:\Users\steve\AppData\Roaming\npm
9 verbose lifecycle @~web: CWD: C:\Users\steve\MyApp
10 silly lifecycle @~web: Args: [ '/d /s /c', 'expo start --web' ]
11 silly lifecycle @~web: Returned: code: 1  signal: null
12 info lifecycle @~web: Failed to exec web script
13 verbose stack Error: @ web: `expo start --web`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid @
15 verbose cwd C:\Users\steve\MyApp
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "web"
18 verbose node v12.18.3
19 verbose npm  v6.14.6
20 error code ELIFECYCLE
21 error errno 1
22 error @ web: `expo start --web`
22 error Exit status 1
23 error Failed at the @ web script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

npm 版本:6.14.6 节点版本:12.18.3 博览会版本:3.26.2

我运行的命令:

npm i -g expo-cli

博览会初始化 MyApp

*选定的空白托管工作流

cd MyApp

npm 开始

任何帮助将不胜感激。

标签: node.jsreact-nativenpm

解决方案


推荐阅读