简体   繁体   English

当我尝试在我的反应应用程序上使用 npm start 时,我不断收到此错误

[英]I keep getting this error while i try to use npm start on my react app

图片

The error keeps coming up every time i use npm start.每次我使用 npm 启动时,错误都会不断出现。 i am a complete beginner我是一个完整的初学者

Traverse to my-app folder which is inside your My App folder and then run npm start遍历到 My App 文件夹中的 my-app 文件夹,然后运行npm start

Congrats on your first react app!恭喜你的第一个反应应用程序!

The npm start command looks in your package.json file for a script. npm start命令在 package.json 文件中查找脚本。 It will look something like this:它看起来像这样:

'scripts': {
     'start': 'node app.js'
}

Your error is saying that your terminal can't find the package.json file at all.您的错误是说您的终端根本找不到 package.json 文件。 Make sure your terminal is in the same directory as your package.json file.确保您的终端与 package.json 文件位于同一目录中。 If you type the ls command in your terminal it should show your package.json file.如果您在终端中键入ls命令,它应该会显示您的 package.json 文件。 If you don't see it, you can use cd.. to move up a directory, or cd {folderName} to move down a directory.如果您没有看到它,您可以使用cd..向上移动一个目录,或者使用cd {folderName}向下移动一个目录。 You want to be in the my-app directory.你想在 my-app 目录中。 The pwd command will print the directory you're currently in. pwd命令将打印您当前所在的目录。

You have created a my app folder inside another my app folder, and your working directory is the first folder which doesn't have a package.json file.您已经在另一个my app文件夹中创建了一个my app文件夹,并且您的工作目录是第一个没有 package.json 文件的文件夹。 You must change your terminal directory to inner my app folder.您必须将终端目录更改为my app文件夹内部。

You need to run your command from directory which contains package.json.您需要从包含 package.json 的目录运行命令。 Probably you will also need to use command nmp run start instead.可能您还需要使用命令nmp run start代替。 By the way folders with spaces in names may cause some problems later.顺便说一下,名称中带有空格的文件夹可能会在以后引起一些问题。 I would recommend to remove spaces.我建议删除空格。

暂无
暂无

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

相关问题 每当我尝试创建新的反应应用程序或尝试启动现有的反应应用程序时出现错误 - Getting error whenever I try to create new react app or try to start existing react app 尝试启动React应用程序时,我不断收到“无法加载资源” - I keep getting “Failed to load resource” when I try to start an React app 当我在 react app 上执行 npm start 时,不断收到“?端口 3000 上已经有东西在运行” - keep getting "? Something is already running on port 3000" when I do npm start on react app 为什么在运行 npm 运行启动时总是出现此错误? 这是 React 的导入错误 - Why do I keep getting this error when running npm run start? It's an import error on React 我一直在尝试创建一个 React 应用程序,但我一直收到此错误:“npm ERR!cb() 从未调用过!” - I've been trying to create a react app but I keep getting this error: "npm ERR! cb() never called!" 在终端中输入 npm start 后,我不断收到此错误 - I keep getting this error after typing npm start into the terminal 我用 create-react-app 创建了一个项目。 在我的 windows 电脑上,但当我尝试在命令行上运行 npm 时,它显示了这个错误。请帮助我 - I created a project with create-react-app. on my windows pc but when is try to run npm start on the command line it shows this error.please help me Npm 尝试创建反应应用程序时出错 - Npm Error when I try to create the react app 尝试在 discord 机器人上运行 npm 启动,但我不断收到“节点:事件”错误。 使用节点 v16.13.1 时 - trying to run npm start on a discord bot but i keep getting a 'node:events' error. While using node v16.13.1 当我尝试在我的 React 应用程序中运行 npm 测试时出现错误“SyntaxError: Cannot use import statement outside a module” - The error "SyntaxError: Cannot use import statement outside a module" appears when I try to run npm test in my react application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM