创建反应应用程序不起作用 [英] create-react-app not working

查看:139
本文介绍了创建反应应用程序不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个非常新的反应者(从一天前开始).我使用create-react-app命令行创建了一个应用程序.以下是我做的顺序

I am very new to react (started a day ago). I used the create-react-app command line to create an app. The following is the order I did

  • create-react-app my-app
  • npm开始

现在应用程序正在运行.

Now app is running.

  • npm安装youtube-api-search
  • npm开始

现在我遇到此错误

my-app@0.1.0开始/用户/shanmugharajk/代码/udemy/my-app 反应脚本开始

my-app@0.1.0 start /Users/shanmugharajk/Code/udemy/my-app react-scripts start

sh:react-scripts:找不到命令npm ERR!文件sh npm ERR!代码 ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall生成npm ERR! my-app@0.1.0开始:react-scripts start npm ERR!产生ENOENT npm 呃! npm ERR!在my-app@0.1.0启动脚本处失败. npm ERR!这 npm可能不是问题.可能还有其他日志记录 上面的输出.

sh: react-scripts: command not found npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! my-app@0.1.0 start: react-scripts start npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the my-app@0.1.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

每次我尝试安装的任何软件包都会发生这种情况.

This happens every single time with any package I try to install.

我注意到的是我跑步的时候

One thins I noted is when i run

  • npm install youtube-api-search或任何打包程序都会删除某些软件包.我在安装任何软件包时收到的消息是

npm WARN注册表使用来自 https://registry.npmjs.org/的陈旧数据 因为主机无法访问-您是否处于离线状态? npm WARN注册表 https://registry.npmjs.org/的意外警告:其他 警告ENOTFOUND:请求 https://registry.npmjs.org/redux 失败, 原因:getaddrinfo ENOTFOUND Registry.npmjs.org Registry.npmjs.org:443 npm WARN注册表使用来自以下版本的过时软件包数据 https://registry.npmjs.org/由于在执行期间出现请求错误 重新验证. npm轻轻警告Rm不移除 /Users/shanmugharajk/Code/udemy/my-app/node_modules/html-minifier/node_modules/.bin/uglifyjs 因为它不是由安装的 /用户/shanmugharajk/代码/udemy/my-app/node_modules/html-minifier/node_modules/uglify-js npm轻轻警告Rm不移除 /用户/shanmugharajk/代码/udemy/my-app/node_modules/espree/node_modules/.bin/acorn 因为它不是由安装的 /用户/shanmugharajk/代码/udemy/my-app/node_modules/espree/node_modules/acorn npm轻轻警告Rm不移除 /用户/shanmugharajk/代码/udemy/my-app/node_modules/autoprefixer/node_modules/.bin/browserslist 因为它不是由安装的 /用户/shanmugharajk/代码/udemy/my-app/node_modules/autoprefixer/node_modules/浏览器列表 npm通知创建了一个作为package-lock.json的锁文件.你应该犯 这个文件. + redux@3.7.1添加了3个程序包,删除了1142个程序包,并在27.043s中更新了3个程序包

npm WARN registry Using stale data from https://registry.npmjs.org/ because the host is inaccessible -- are you offline? npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning ENOTFOUND: request to https://registry.npmjs.org/redux failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443 npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation. npm WARN gentlyRm not removing /Users/shanmugharajk/Code/udemy/my-app/node_modules/html-minifier/node_modules/.bin/uglifyjs as it wasn't installed by /Users/shanmugharajk/Code/udemy/my-app/node_modules/html-minifier/node_modules/uglify-js npm WARN gentlyRm not removing /Users/shanmugharajk/Code/udemy/my-app/node_modules/espree/node_modules/.bin/acorn as it wasn't installed by /Users/shanmugharajk/Code/udemy/my-app/node_modules/espree/node_modules/acorn npm WARN gentlyRm not removing /Users/shanmugharajk/Code/udemy/my-app/node_modules/autoprefixer/node_modules/.bin/browserslist as it wasn't installed by /Users/shanmugharajk/Code/udemy/my-app/node_modules/autoprefixer/node_modules/browserslist npm notice created a lockfile as package-lock.json. You should commit this file. + redux@3.7.1 added 3 packages, removed 1142 packages and updated 3 packages in 27.043s

我不知道原因.请帮助我.

I couldn't figure out the reason. Please help me.

推荐答案

您正在使用npm5.目前,它有很多问题.

You are using npm 5. At the moment it has many issues.

我建议降级为npm 4,然后重试:

I recommend to downgrade to npm 4 and try again:

npm install -g npm@4

rm -rf node_modules
rm package-lock.json
npm install

如果这没有帮助检查您的互联网连接. 这似乎是您的网络存在的问题:

If it doesn't help check your internet connection. This looks like an issue with your network:

getaddrinfo ENOTFOUND注册表.npmjs.org注册表.npmjs.org:443

getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443

这篇关于创建反应应用程序不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆