简体   繁体   English

“npm start”不适用于任何 react-js 项目

[英]"npm start" doesn't work on any react-js project

[package.json] i tried everything i tried to update npm, node, webpack also. [package.json]我尝试了所有尝试更新 npm、node、webpack 的方法。

this is what i do: npx create-react-app testapp这就是我所做的: npx create-react-app testapp

cd testapp cd testapp

npm start or yarn start npm start 或 yarn start

give me this:给我这个:

OUTPUT:输出:

There might be a problem with the project dependency tree.项目依赖树可能有问题。 It is likely not a bug in Create React App, but something you need to fix locally.这可能不是 Create React App 中的错误,而是您需要在本地修复的问题。

The react-scripts package provided by Create React App requires a dependency: Create React App 提供的 react-scripts 包需要一个依赖:

"webpack": "4.39.1" "webpack": "4.39.1"

Don't try to install it manually: your package manager does it automatically.不要尝试手动安装:您的包管理器会自动安装。 However, a different version of webpack was detected higher up in the tree:但是,在树的更高位置检测到了不同版本的 webpack:

C:\\node_modules\\webpack (version: 4.38.0) C:\\node_modules\\webpack(版本:4.38.0)

Manually installing incompatible versions is known to cause hard-to-debug issues.众所周知,手动安装不兼容的版本会导致难以调试的问题。

If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.如果您希望忽略此检查,请将 SKIP_PREFLIGHT_CHECK=true 添加到项目中的 .env 文件中。 That will permanently disable this message but you might encounter other issues.这将永久禁用此消息,但您可能会遇到其他问题。

npm ERR! npm 错误! errno 1 npm ERR!错误号 1 npm 错误号! client@0.1.0 start: react-scripts start npm ERR! client@0.1.0 start: react-scripts start npm ERR! Exit status 1 npm ERR!退出状态 1 npm ERR! npm ERR! npm 错误! Failed at the client@0.1.0 start script. client@0.1.0 启动脚本失败。 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:可以在以下位置找到此运行的完整日志:

Thanks a lot for all but after many tries i created a .env file then i put this into it SKIP_PREFLIGHT_CHECK=true then yarn start or npm start and it worked非常感谢所有人,但经过多次尝试,我创建了一个 .env 文件,然后将其放入其中SKIP_PREFLIGHT_CHECK=true然后 yarn start 或 npm start 并且它起作用了

@MedetTleukabiluly who told me in comments thanks a lot @MedetTleukabiluly 在评论中告诉我非常感谢

这将永久禁用此消息,但您可能会遇到其他问题。

我建议使用Yarn ,而不是将SKIP_PREFLIGHT_CHECK=true添加到项目中的 .env 文件

I had countered the same case, I solved via this link我已经反驳了同样的案例,我通过这个链接解决了

If you've previously installed create-react-app globally via npm install -g create-react-app , we recommend you uninstall the package using npm uninstall -g create-react-app to ensure that npx always uses the latest version```如果您已安装了create-react-app全球范围内通过npm install -g create-react-app ,我们建议您使用卸载包npm uninstall -g create-react-app ,以确保NPX总是使用最新的version`` `

[ https://create-react-app.dev/docs/getting-started] [ https://create-react-app.dev/docs/getting-started ]

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

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