项目是用 React Create App 创建的,编译的命令为:react-scripts build,
报错:
gitpod /workspace/blog/admin $ npm run build
> [email protected] build
> react-scripts build
Creating an optimized production build...
Failed to compile.
./src/components/Users.js
Line 109:3: 'fetchUserStatus' is not defined no-undef
Line 124:3: 'fetchData' is not defined no-undef
Line 140:3: 'addUser' is not defined no-undef
Line 144:3: 'deleteUser' is not defined no-undef
Line 157:3: 'editUser' is not defined no-undef
离谱点在于:
- 我在本地( Windows 10 ),WSL ( Ubuntu 20.04 )以及服务器( Ubuntu 16.04 )上编译都是没问题的。
- 但是 Heroku 上部署的版本编译时就出现上述报错,Gitpod 上也是如此,docker 里构建也是如此。
- 之前的版本 Heroku 上是可以成功编译的,但是我现在用 Gitpod 切换到之前的版本,发现也不行了。。
项目地址是: https://github.com/songquanpeng/blog/tree/master/admin
注意是 admin 文件夹中的那个。