Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: unable to load the configuration: unable to read "PROJECT" file: read PROJECT: is a directory get error #2666

Closed
631068264 opened this issue Apr 30, 2022 · 12 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@631068264
Copy link

631068264 commented Apr 30, 2022

What broke? What's expected?

downlowd from https://github.com/kubernetes-sigs/kubebuilder/releases/download/v3.4.0/kubebuilder_darwin_amd64

follow it https://book.kubebuilder.io/quick-start.html#installation to install

use kubebuilder version get same error

~ kubebuilder completion zsh
Error: unable to load the configuration: unable to read "PROJECT" file: read PROJECT: is a directory
Usage:
  kubebuilder [flags]

Examples:
The first step is to initialize your project:
    kubebuilder init [--plugins=<PLUGIN KEYS> [--project-version=<PROJECT VERSION>]]

<PLUGIN KEYS> is a comma-separated list of plugin keys from the following table
and <PROJECT VERSION> a supported project version for these plugins.

                        Plugin keys | Supported project versions
------------------------------------+----------------------------
          base.go.kubebuilder.io/v3 |                          3
   declarative.go.kubebuilder.io/v1 |                       2, 3
               go.kubebuilder.io/v2 |                       2, 3
               go.kubebuilder.io/v3 |                          3
 kustomize.common.kubebuilder.io/v1 |                          3

For more specific help for the init command of a certain plugins and project version
configuration please run:
    kubebuilder init --help --plugins=<PLUGIN KEYS> [--project-version=<PROJECT VERSION>]

Default plugin keys: "go.kubebuilder.io/v3"
Default project version: "3"


Flags:
  -h, --help                     help for kubebuilder
      --plugins strings          plugin keys to be used for this subcommand execution
      --project-version string   project version (default "3")

2022/04/30 22:34:37 unable to load the configuration: unable to read "PROJECT" file: read PROJECT: is a directory

Reproducing this issue

No response

KubeBuilder (CLI) Version

3.4.0

PROJECT version

No response

Plugin versions

No response

Other versions

No response

Extra Labels

No response

@631068264 631068264 added the kind/bug Categorizes issue or PR as related to a bug. label Apr 30, 2022
@camilamacedo86
Copy link
Member

Hi @631068264,

Are using a go version >= 1.17 and < 1.18 ?
Are you scaffolding the projects in a directory where the tool will have permission to write?

I am unable to reproduce this one. Could you please let us know more about ?

@631068264
Copy link
Author

631068264 commented May 5, 2022

@camilamacedo86 ,

go version go1.17.6 darwin/amd64

OSX 12.3.1

I just download it , remove it to /usr/local/bin/kubebuilder , and then run kubebuilder version without creating any project or directory .

the cmd create run very well just version get error

image

It's confused that I just want to get version or set zsh why it‘s related to a "porject"?

@camilamacedo86
Copy link
Member

camilamacedo86 commented May 5, 2022

Are you able to create new projects?
Are you able to: * In your GOPATH

mkdir test
cd test
kubebuilder init

The PROJECT file is where we store the data about the PROJECT scaffold.
It might be an issue with the CLI where we are looking to load the PROJECT file in commands that this information is not required.

@631068264
Copy link
Author

image

`kubebuilder init` is well

What is * In your GOPATH mean?

@camilamacedo86
Copy link
Member

Hi @631068264,

I am unable to reproduce this issue:

$ kubebuilder_darwin_amd64 version
Version: main.version{KubeBuilderVersion:"3.3.0", KubernetesVendor:"1.23.1", GitCommit:"47859bf2ebf96a64db69a2f7074ffdec7f15c1ec", BuildDate:"2022-01-18T17:03:29Z", GoOs:"darwin", GoArch:"amd64"}

I was a bug in the past, so you might call an old binary instead of this version ( it probably is another place in your local env ) when you see this error. See #2126 ( this fix was released with v3.0.0: https://github.com/kubernetes-sigs/kubebuilder/releases/tag/v3.0.0

What is * In your GOPATH mean?

GOPATH is the path of your Golang local environment. Check your golang env. ($ go env)

I'd recommend you remove this bin from /usr/local/bin/kubebuilder and run the kubebuilder version it probably will still be called, and you probably have a kubebuilder CLI binary installed in another place. Then, remove the kubebuilder bin from all places ( you can check that by running kuebuilder version until it does not output command not found you have a bin installed in your local env ). After that try to re-install the latest version or this specific release.

@geetikabatra
Copy link

I can confirm the issue. This is a recurring one, even with v3.0.0

@camilamacedo86
Copy link
Member

Hi @geetikabatra,

Could you please do the test with the full path to the bin?
Example:

a) to show the version:

 /Users/camilamacedo86/go/bin/kubebuilder version
Version: main.version{KubeBuilderVersion:"v3.0.0-alpha.0-540-ga31e4b0b", KubernetesVendor:"unknown", GitCommit:"a31e4b0b25ea2c278bee042a7fc86ec244bb7de4", BuildDate:"2022-05-09T14:03:37Z", GoOs:"darwin", GoArch:"amd64"}

b) to reproduce the issue /Users/camilamacedo86/go/bin/kubebuilder init

c) to check if the profile is the config for another bin. Now only run kubebuilder version without path

@631068264
Copy link
Author

631068264 commented May 19, 2022

@camilamacedo86

full path test

➜  ~ which kubebuilder
/usr/local/bin/kubebuilder
➜  ~ /usr/local/bin/kubebuilder version
Error: unable to load the configuration: unable to read "PROJECT" file: read PROJECT: is a directory
Usage:
  kubebuilder [flags]

Examples:
The first step is to initialize your project:
    kubebuilder init [--plugins=<PLUGIN KEYS> [--project-version=<PROJECT VERSION>]]

<PLUGIN KEYS> is a comma-separated list of plugin keys from the following table
and <PROJECT VERSION> a supported project version for these plugins.

                        Plugin keys | Supported project versions
------------------------------------+----------------------------
          base.go.kubebuilder.io/v3 |                          3
   declarative.go.kubebuilder.io/v1 |                       2, 3
               go.kubebuilder.io/v2 |                       2, 3
               go.kubebuilder.io/v3 |                          3
 kustomize.common.kubebuilder.io/v1 |                          3

For more specific help for the init command of a certain plugins and project version
configuration please run:
    kubebuilder init --help --plugins=<PLUGIN KEYS> [--project-version=<PROJECT VERSION>]

Default plugin keys: "go.kubebuilder.io/v3"
Default project version: "3"


Flags:
  -h, --help                     help for kubebuilder
      --plugins strings          plugin keys to be used for this subcommand execution
      --project-version string   project version (default "3")

2022/05/19 15:11:39 unable to load the configuration: unable to read "PROJECT" file: read PROJECT: is a directory

even I download the latest version get same error

➜  ~ /Users/wyx/Downloads/kubebuilder_darwin_amd64
zsh: permission denied: /Users/wyx/Downloads/kubebuilder_darwin_amd64
➜  ~ chmod +x /Users/wyx/Downloads/kubebuilder_darwin_amd64
➜  ~ /Users/wyx/Downloads/kubebuilder_darwin_amd64 version
Error: unable to load the configuration: unable to read "PROJECT" file: read PROJECT: is a directory
Usage:
  kubebuilder [flags]

Examples:
The first step is to initialize your project:
    kubebuilder init [--plugins=<PLUGIN KEYS> [--project-version=<PROJECT VERSION>]]

<PLUGIN KEYS> is a comma-separated list of plugin keys from the following table
and <PROJECT VERSION> a supported project version for these plugins.

                        Plugin keys | Supported project versions
------------------------------------+----------------------------
          base.go.kubebuilder.io/v3 |                          3
   declarative.go.kubebuilder.io/v1 |                       2, 3
               go.kubebuilder.io/v2 |                       2, 3
               go.kubebuilder.io/v3 |                          3
 kustomize.common.kubebuilder.io/v1 |                          3

For more specific help for the init command of a certain plugins and project version
configuration please run:
    kubebuilder init --help --plugins=<PLUGIN KEYS> [--project-version=<PROJECT VERSION>]

Default plugin keys: "go.kubebuilder.io/v3"
Default project version: "3"


Flags:
  -h, --help                     help for kubebuilder
      --plugins strings          plugin keys to be used for this subcommand execution
      --project-version string   project version (default "3")

2022/05/19 15:14:32 unable to load the configuration: unable to read "PROJECT" file: read PROJECT: is a directory
➜  ~

go env

➜  ~ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN="/Users/wyx/go/bin"
GOCACHE="/Users/wyx/Library/Caches/go-build"
GOENV="/Users/wyx/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/wyx/go/pkg/mod"
GONOPROXY="github.com/mmqbaba"
GONOSUMDB="github.com/mmqbaba"
GOOS="darwin"
GOPATH="/Users/wyx/go"
GOPRIVATE="github.com/mmqbaba"
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/local/Cellar/go/1.18.1/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.18.1/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.18.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/pr/y105tp4s1w761lxysjs2pg0m0000gn/T/go-build4119938951=/tmp/go-build -gno-record-gcc-switches -fno-common"

just only one version

➜  ~ rm -rf /usr/local/bin/kubebuilder
➜  ~ kubebuilder version
zsh: command not found: kubebuilder
➜  ~

@camilamacedo86
Copy link
Member

Hi @631068264,

I tried to reproduce your scenario with the latest releases, and I am unable.
Note that we cannot ensure the version of the bin used with the tests made above.

Another thing that calls my attention is that you are using GOVERSION="go1.18.1" ad it is not supported
You must use go versions >= 1.17 < 1.18.

Could you check if that might no be the root cause as well?

@camilamacedo86
Copy link
Member

I am closing this one since it seems like caused by not being using the golang version not supported ( see https://book.kubebuilder.io/quick-start.html#prerequisites ) or an old bin where the fix was not done.

However, please feel free to re-open this one if you see that it is required.

@islishude
Copy link

I can replicate this issue, and I just got the reason.

because I have a project directory in my HOME path.

$ ls 
go.mod  main.go
$ mkdir project
$ cat main.go
package main

import (
        "fmt"
        "os"
)

func main() {
        stat, err := os.Stat("PROJECT")
        if err != nil {
                panic(err)
        }
        fmt.Println(stat.Name(), stat.IsDir())
}
$ go run main.go
PROJECT true

I'm not sure why the os.Stat function is not case-sensitive, maybe it's a bug?

@xiao-jay
Copy link
Contributor

I think filesystem is not case-sensitive.

➜  test ls 
➜  test echo "aaa" > PROJECT
➜  test cat PROJECT 
aaa
➜  test mkdir project
mkdir: project: File exists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

5 participants