gpt4 book ai didi

reactjs - 将警告视为错误,因为 process.env.CI = true。编译失败

转载 作者:行者123 更新时间:2023-12-03 15:34:51 27 4
gpt4 key购买 nike

我正在开发一个用于自学目的的 react 天气应用程序。
在 gh-pages 中部署相同。
网址
https://davisraimon.github.io/react-weather/
repo
https://github.com/davisraimon/react-weather
尝试将我的应用程序与 集成时Travis Ci ,我得到如下错误。
它说我必须更改一些名为 Process.env.CI 的环境变量。

$ git clone --depth=50 --branch=master https://github.com/davisraimon/react-weather.git davisraimon/react-weather
nvm.install
4.18s$ nvm install stable
cache.1
Setting up build cache
cache.npm
$ node --version
v14.4.0
$ npm --version
6.14.5
$ nvm --version
0.35.3
install.npm
13.21s$ npm ci
7.45s$ npm run build
> react-weather@0.1.0 build /home/travis/build/davisraimon/react-weather
> react-scripts build
Creating an optimized production build...
Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.
Failed to compile.
./src/components/form.component.js
Line 1:17: 'Component' is defined but never used no-unused-vars
./src/App.js
Line 2:8: 'logo' is defined but never used no-unused-vars
Line 8:7: 'API_key' is assigned a value but never used no-unused-vars
Line 37:5: Expected a default case default-case
Line 53:14: Expected '===' and instead saw '==' eqeqeq
Line 69:20: Expected '===' and instead saw '==' eqeqeq
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-weather@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-weather@0.1.0 build 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/travis/.npm/_logs/2020-06-30T17_45_07_887Z-debug.log
The command "npm run build" exited with 1.
cache.2
store build cache
我在 .travis.yml 文件中添加了 env 变量。
env:
process.env.CI : false
仍然显示相同的错误。
任何人都可以帮助我摆脱这种情况吗...

最佳答案

  "scripts": {
"start": "react-scripts start",
"build": "CI=false && react-scripts build", // Add CI=False here
"test": "react-scripts test",
"eject": "react-scripts eject"
},

关于reactjs - 将警告视为错误,因为 process.env.CI = true。编译失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62663451/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com