React App 安装后编译失败 [英] React App failed to compile after install

查看:109
本文介绍了React App 安装后编译失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行安装脚本后,服务器启动并提供一个页面,在编译失败"行后显示相同的文本.

After running the install script, the server starts and serves a page displaying the same text after the 'Failed to compile line.'

我正在运行 Windows 10 并且自动更新今天刚刚更新了我的电脑,就在我进行 create-react-express 安装之前.

I'm running Windows 10 and auto update just updated my pc today, right before I did the create-react-express install.

PS H:\mern-passport> npm start

> mern@1.0.0 start H:\mern-passport
> if-env NODE_ENV=production && npm run start:prod || npm run start:dev


> mern@1.0.0 start:dev H:\mern-passport
> concurrently "nodemon --ignore 'client/*'" "npm run client"

[0] [nodemon] 1.19.4
[0] [nodemon] to restart at any time, enter `rs`
[0] [nodemon] watching dir(s): *.*
[0] [nodemon] watching extensions: js,mjs,json  
[0] [nodemon] starting `node server.js`
[0] API server now on port 3001!
[1] 
[1] > mern@1.0.0 client H:\mern-passport
[1] > cd client && npm run start
[1]
[1] 
[1] > mern@0.1.0 start H:\mern-passport\client
[1] > react-scripts start
[1]
[1] Starting the development server...
[1]
[1] Failed to compile.
[1]
[1] ./src/index.css (./node_modules/css-loader??ref--6-oneOf-3-1!./node_modules/postcss-loader/src??postcss!./src/index.css)
[1] Error: Package exports for 'H:\mern-passport\client\node_modules\autoprefixer\node_modules\kleur' do not define a valid './colors' target
[0] Error: ENOENT: no such file or directory, stat 'H:\mern-passport\client\build\index.html'
[0] Error: ENOENT: no such file or directory, stat 'H:\mern-passport\client\build\index.html'

推荐答案

似乎是 autoprefixer 最新版本的问题.我提到了 https://github.com/postcss/autoprefixer/issues/1328 和尝试在我的项目中降级 autoprefixer,现在可以使用了.试试:

Seems to be an issue with autoprefixer latest version. I referred https://github.com/postcss/autoprefixer/issues/1328 and tried downgrading autoprefixer in my project and it works now. Try:

npm install autoprefixer@9.8.0

快乐编码!

这篇关于React App 安装后编译失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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