Windows 10 我整天都在努力寻找解决方案,但没有找到合适的答案。我正在尝试创建一个React Native项目。今天早些时候,我能够完成创建应用程序的工作,然后陷入尝试使用Expo同步我的android设备的过程。在修改网络设置时,我似乎有些混乱,因为现在我什至无法到达命令提示符下的“ Expo”屏幕。我可以在终端中创建该应用程序,然后当我输入“ npm start”时,它表示正在启动打包程序,然后在大约10秒钟后超时并给出一些错误消息。我已经卸载并重新安装了nodejs,将项目移到了一个全新的文件夹中,问题仍然存在。
这是在命令提示符下打印出来的代码
npm错误!代码ELIFECYCLE
npm ERR! errno 1
npm ERR! todoapp@0.1.0开始:react-native-scripts start
npm ERR!退出状态1
npm错误!
npm ERR!在todoapp@0.1.0启动脚本处失败。
npm ERR! npm可能不是问题。上面可能还有其他日志记录输出。
npm错误!可以在以下位置找到此运行的完整日志:
npm ERR! C:\ Users \ cembr \ AppData \ Roaming \ npm-cache_logs \ 2018-08-18T03_05_05_427Z-debug.log
这是调试日志:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\cembr\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm@6.4.0
3 info using node@v8.11.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle todoapp@0.1.0~prestart: todoapp@0.1.0
6 info lifecycle todoapp@0.1.0~start: todoapp@0.1.0
7 verbose lifecycle todoapp@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle todoapp@0.1.0~start: PATH: C:\Users\cembr\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\cembr\OneDrive\Documents\Web Design\todoapp\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Gpg4win\..\GnuPG\bin;C:\Program Files\Microsoft VS Code\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\nodejs\;C:\Users\cembr\AppData\Local\Microsoft\WindowsApps;C:\Users\cembr\AppData\Local\Yarn\bin;C:\Users\cembr\AppData\Roaming\npm
9 verbose lifecycle todoapp@0.1.0~start: CWD: C:\Users\cembr\OneDrive\Documents\Web Design\todoapp
10 silly lifecycle todoapp@0.1.0~start: Args: [ '/d /s /c', 'react-native-scripts start' ]
11 silly lifecycle todoapp@0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle todoapp@0.1.0~start: Failed to exec start script
13 verbose stack Error: todoapp@0.1.0 start: `react-native-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\cembr\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\cembr\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid todoapp@0.1.0
15 verbose cwd C:\Users\cembr\OneDrive\Documents\Web Design\todoapp
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\cembr\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v8.11.4
19 verbose npm v6.4.0
20 error code ELIFECYCLE
21 error errno 1
22 error todoapp@0.1.0 start: `react-native-scripts start`
22 error Exit status 1
23 error Failed at the todoapp@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
答案 0 :(得分:0)
尝试键入这些命令
sudo sysctl -w fs.inotify.max_user_instances=1024
sudo sysctl -w fs.inotify.max_user_watches=12288
发现于 https://github.com/react-community/create-react-native-app/issues/533
答案 1 :(得分:0)
这一定是NPM的错误,并且使用
杀死了节点进程杀死-9 PID的进程,您可以重新启动NPM,然后它将起作用。
查找过程
lsof -i:8081然后
杀死节点进程的-9 PID