简体   繁体   English

如何修复此 npm 开始不起作用(在 npx create-react-app 之后)

[英]how to fix this npm start not working ( after npx create-react-app )

 npm ERR. code ELIFECYCLE npm ERR. errno 1 npm ERR: todos-clone-app@0.1.0 start. `react-scripts start` npm ERR. Exit status 1 npm ERR. npm ERR: Failed at the todos-clone-app@0.1.0 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! /home/josh/.npm/_logs/2020-08-21T19_28_35_521Z-debug.log

Edit:编辑:

package.json package.json

{
  "name": "todos-clone-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.3",
    "webpack-dev-server": "^3.11.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [ ">0.2%", "not dead", "not op_mini all" ],
    "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ]
  }
}

Try deleting your node_modules directory and package-lock.json file.尝试删除您的node_modules目录和package-lock.json文件。 Then run npm install .然后运行npm install

In my case, it was because of not being in the right folder.就我而言,这是因为不在正确的文件夹中。

Generally, I create a folder and go to Vs code to open it for typing create-react-app "folder name" to the console.通常,我创建一个文件夹和 go 到 Vs 代码以打开它,以便在控制台中键入 create-react-app“文件夹名称”。

The problem was I was trying to npm start in parent folder instead of "folder name".问题是我试图在父文件夹而不是“文件夹名”中启动 npm。

all you have to do is你所要做的就是
1-cd folder name 1-cd 文件夹名称
2-npm start. 2-npm 开始。

It should work.它应该工作。

try=> npx create-react-app./ it worked for me try=> npx create-react-app./ 它对我有用

暂无
暂无

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

相关问题 使用 npx create-react-app 创建应用后<myproject> ,并使用“npm start”启动应用程序我得到了下面提到的这个错误</myproject> - After creating app using npx create-react-app <myproject> , and start app by using "npm start" i got this error mentioned below 在创建反应项目时在“npx create-react-app my-app”之后运行命令“npm start”时出错 - getting error when run command 'npm start' after 'npx create-react-app my-app' in creating a react project 在“npx create-react-app”“npm start”失败并出现以下错误后:TypeError: Cannot read property 'split' of undefined - After "npx create-react-app" "npm start" fails with following error: TypeError: Cannot read property 'split' of undefined npx create-react-app 命令不起作用 - npx create-react-app command is not working “npx create-react-app appname”不起作用 - “npx create-react-app appname” not working 运行 npm 启动和使用 npx create-react-app 创建 React 应用程序时出错 - Error running npm start and creating React application using npx create-react-app 使用 npx create-react-app 创建的应用无法启动, - App created with npx create-react-app failed to start, 无法运行 NPM 在 create-react-app 之后启动 - Not able to run NPM Start after create-react-app 仅在 Documents 目录中运行 create-react-app 后,Npm 开始不起作用 - Npm start not working after running create-react-app ONLY in Documents directory 如何修复 create-react-app 中的 npm ENOENT 错误? - How to fix npm ENOENT error in create-react-app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM