YouCompleteMe icon indicating copy to clipboard operation
YouCompleteMe copied to clipboard

Build Error: Go: go.mod file not found & NPM: Unsupport Engine

Open Eroge-Newton opened this issue 1 year ago • 5 comments

I built YCM two years ago on my new laptop(Ubuntu 22.04) and it works fine. Today, I try to build YCM on a VPS(Ubuntu 22.04) but something wrong.

I want to build go , ts and mono completer, but only mono compiles successfully.

I've looked up issues and installation guides, as well as the detailed compilation guide, but there's not much information that solves the problem.

System and software info:

OS: Ubuntu 22.04.4 LTS 
Memery: 2 GB 
Disk: 20 GB 
Kernel: 6.5.0-18-generic 

Vim: 8.2.3995 
Python: 3.10 
mono: 6.8.0.105 
go: 1.18.1 LTS 
nodejs: 12.22.9 
npm: 8.5.1 

While I trying to compile go:

$ python3 ./install.py --verbose --cs-completer --go-completer --ts-completer

# The ending part
third_party/go/pkg/mod/golang.org/x/tools/[email protected]/internal/golang/comment.go:12:2: package go/doc/comment is not in GOROOT (/usr/lib/go-1.18/src/go/doc/comment)
go: go.mod file not found in current directory or any parent directory.
        'go get' is no longer supported outside a module.
        To build and install a command, use 'go install' with a version,
        like 'go install example.com/cmd@latest'
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.
$ 

What's more, if just compile TypeScript completer, will get the "Unsupported Engine" warnning message.

$ python3 ./install.py --verbose --cs-completer --ts-completer

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '>=14.17' },
npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.5.1' }
npm WARN EBADENGINE }
$

YCM log:

:Ycm
Printing YouCompleteMe debug information...                                                                                  
-- Resolve completions: Never                                                                                                
-- Client logfile: /tmp/ycm_b8yxng5a.log                                                                                     
-- Server Python interpreter: /usr/bin/python3                                                                               
-- Server Python version: 3.10.12                                                                                            
-- Server has Clang support compiled in: False                                                                               
-- Clang version: None                                                                                                       
-- Extra configuration file found and loaded                                                                                 
-- Extra configuration path: /home/tmp/.vim/plugged/YouCompleteMe/third_party/ycmd/.ycm_extra_conf.py                        
-- Server running at: http://127.0.0.1:55357                                                                                 
-- Server process ID: 15438                                                                                                  
-- Server logfiles:                                                                                                          
--   /tmp/ycmd_55357_stdout_b0_ff4bz.log                                                                                     
--   /tmp/ycmd_55357_stderr_aes77liw.log                                                                                     
-- Semantic highlighting supported: True                                                                                     
-- Virtual text supported: False                                                                                             
-- Popup windows supported: True                                                                                             
Press ENTER or type command to continue    



:YcmToggleLogs                                                                                                               
Which logfile do you wish to open (or close if already open)?                                                                
1: tsserver_5hyq8_co.log                                                                                                     
2: ycm_z_d6al82.log                                                                                                          
3: ycmd_37645_stderr_n6x9u6_6.log                                                                                            
4: ycmd_37645_stdout_960a_51t.log                                                                                            
Type number and <Enter> or click with the mouse (q or empty cancels):   

Full log with --verbose : Full-log--verbose.txt

Eroge-Newton avatar Aug 19 '24 08:08 Eroge-Newton

After testing, the low version of NPM that comes with Ubuntu 22.04 doesn't seem to affect usage. But Go...

Eroge-Newton avatar Aug 19 '24 10:08 Eroge-Newton

similar GO bug here

Building gopls for go completion...# golang.org/x/telemetry/crashmonitor
third_party/go/pkg/mod/golang.org/x/[email protected]/crashmonitor/crash_go123.go:13:19: cannot use debug.SetCrashOutput (value of type func(f *os.File, opts debug.CrashOptions) error) as func(*os.File) error value in assignment

FAILED
Trying legacy get get...go: go.mod file not found in current directory or any parent directory.
	'go get' is no longer supported outside a module.
	To build and install a command, use 'go install' with a version,
	like 'go install example.com/cmd@latest'
	For more information, see https://golang.org/doc/go-get-install-deprecation
	or run 'go help get' or 'go help install'.

FAILED

Yuanhao-JIANG avatar Aug 25 '24 10:08 Yuanhao-JIANG

@Yuanhao-JIANG It is gopls related, but not similar. You need to check out the latest ycmd. Try

git submodule update --remote
./install.py --whatever-args-you-use

bstaletic avatar Aug 25 '24 14:08 bstaletic

@Yuanhao-JIANG It is gopls related, but not similar. You need to check out the latest ycmd. Try

git submodule update --remote
./install.py --whatever-args-you-use

Thanks, that works. I am using vim plug for that, do I leave it like that and update as usual next time though VimPlug, or I run this command next time manually when we have an update?

Yuanhao-JIANG avatar Aug 25 '24 14:08 Yuanhao-JIANG

@Yuanhao-JIANG Now that #4259 has been merged, you will be able to update normally. The pull request simply did the same thing you did manualy with the git submodule command.

bstaletic avatar Aug 27 '24 19:08 bstaletic

With #4260 updating the docs for Ubuntu 24.04 and #4259 updating the gopls that we pull in, I think we can close this issue. The problem on Ubuntu 22.04 is that it ships an old go compiler and users need a PPA in order to upgrade.

bstaletic avatar Sep 12 '24 01:09 bstaletic