我想通过以下命令运行一个react原生应用程序:
npm i -g expo-cli
expo init myapp
cd myapp
npm start
但我得到了以下错误,地铁保镖不工作:
Opening DevTools in the browser... (press shift-d to disable)
Error: spawn powershell ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
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:Usersnathan-hpAppDataRoamingnpm-cache_logs2020-09-22T14_48_10_269Z-debug.log
我把这个添加到路径:
C:WindowsSystem32
但我仍然得到以上的错误
好吧,这就是解决方案:问题是:
Error: spawn powershell ENOENT
所以我需要添加:
C: \Windows\System32\WindowsPowerShell \v1.0
到路径。
我以管理员身份打开Windows PowerShell并运行:
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
在cmd中再次运行
npm start
,然后metro boundler打开
- 我昨天做了那个命令,但不知怎么的没用,我想我错过了什么。完整的解释可以在这里找到:https://www.youtube.com/watch?reload=9&v=nfX7HtNiCZI