简体   繁体   English

npm start 不适用于本机设置

[英]npm start not working for react native setup

Hei, I'm new to programming and trying to Setup my toolchain and create a new React Native project.嘿,我是编程新手,正在尝试设置我的工具链并创建一个新的 React Native 项目。

  • If needed, install code editor (+ extensions), git, npm如果需要,安装代码编辑器(+ 扩展)、git、npm
  • Install the Expo app to your phone.将 Expo 应用程序安装到您的手机上。 iOS or Android iOS 或安卓
  • Use the expo CLI tool to generate an app skeleton使用 expo CLI 工具生成应用程序框架
  • Create a folder for your React Native projects为你的 React Native 项目创建一个文件夹
  • use Git Bash or terminal to go to this folder cd foldername/otherfoldername/etc...使用 Git Bash 或终端转到此文件夹 cd foldername/otherfoldername/etc...
  • npm install -g expo-cli npm install -g expo-cli
  • expo init MyApp --npm博览会 init MyApp --npm
  • choose 'blank' template选择“空白”模板
  • if this fails on Windows due to missing interactive mode, use cmd instead of Git Bash Test that app works;如果由于缺少交互模式而在 Windows 上失败,请使用 cmd 而不是 Git Bash 测试该应用程序是否有效; run it and open in the browser (the interactive shell is needed to get the menu option (w) for launching in browser)运行它并在浏览器中打开(需要交互式 shell 来获取在浏览器中启动的菜单选项 (w))
  • cd MyApp光盘我的应用程序
  • npm start <--- npm 开始 <---
  • From now on open 'MyApp' folder in your editor/IDE to edit your project Create a remote git repository (Github) and push your app there从现在开始在您的编辑器/IDE 中打开“MyApp”文件夹以编辑您的项目创建一个远程 git 存储库 (Github) 并将您的应用程序推送到那里

I have done these but I get this error when I write in my VScode npm run我已经完成了这些,但是当我在 VScode npm run 中写入时出现此错误

  • expo start博览会开始

  • Starting project at C:\\Users\\35845\\Documents\\ReactNativeProject\\MyApp在 C:\\Users\\35845\\Documents\\ReactNativeProject\\MyApp 启动项目

  • Expo DevTools is running at http://localhost:19002 Expo DevTools 运行在 http://localhost:19002

  • Opening DevTools in the browser... (press shift-d to disable)在浏览器中打开 DevTools...(按 shift-d 禁用)

  • Error: spawn powershell ENOENT错误:生成 powershell ENOENT

  • at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)在 Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)

  •  at onErrorNT (internal/child_process.js:415:16)* at process._tickCallback (internal/process/next_tick.js:63:19)
  • npm ERR! npm 错误! code ELIFECYCLE代码生命周期

  • npm ERR! npm 错误! errno 1错误号 1

  • npm ERR! npm 错误! @ start: expo start @开始: expo start

  • npm ERR! npm 错误! Exit status 1退出状态 1

  • npm ERR! npm 错误!

  • npm ERR! npm 错误! Failed at the @ start script. @start 脚本失败。

  • npm ERR! npm 错误! This is probably not a problem with npm.这可能不是 npm 的问题。 There is likely additional logging output above.上面可能有额外的日志输出。

  • npm ERR! npm 错误! A complete log of this run can be found in:可以在以下位置找到此运行的完整日志:

  • npm ERR! npm 错误! C:\\Users\\35845\\AppData\\Roaming\\npm-cache_logs\\2020-08-26T08_53_44_736Z-debug.log C:\\Users\\35845\\AppData\\Roaming\\npm-cache_logs\\2020-08-26T08_53_44_736Z-debug.log

Can someone please help me with this.有人可以帮我解决这个问题。 Thank you谢谢

use cmd instead of git bash or PowerShell on windows and try below steps and run:-在 Windows 上使用 cmd 而不是 git bash 或 PowerShell 并尝试以下步骤并运行:-

Delete node_modules folder
run npm cache clean --force
npm install
expo start

make sure you are inside your application folder (where package.json is present)确保你在你的应用程序文件夹中(package.json 所在的位置)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM