is it possible to use coc.nvim extensions behind a firewall? - vim

In my case, I am trying to use coc-clangd at work where we have a firewall, preventing access to external resources (like github). There is however a way to have a local mirror of github repos. This is where i have copies of coc.nvim and clangd/coc-clangd:
Installing this extension, however, doesn't work out of the box:
First method: :CocInstall http://companymirror/github/clangd/coc-clangd.git
results ... in is not supported, coc.nvim support github.com only
Second method: Plug 'clangd/coc-clangd', {'do': 'yarn install --frozen-lockfile'} (in .vimrc with vim-plug)
results in an error on :PlugInstall:
warning package.json: License should be a valid SPDX license expression
warning coc-clangd#0.4.10: License should be a valid SPDX license expression
[1/5] Validating package.json...
warning coc-clangd#0.4.10: License should be a valid SPDX license expression
warning coc-clangd#0.4.10: The engine "coc" appears to be invalid.
[2/5] Resolving packages...
[3/5] Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/readdirp/-/readdirp-3.4.0.tgz: self signed certificate in certificate chain".
info If you think this is a bug, please open a bug report with the information provided in "/home/user/.vim/plugged/coc-clangd/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
where /home/user/.vim/plugged/coc-clangd/yarn-error.log has:
Arguments:
/usr/local/node-v12.18.0-linux-x64/bin/node /usr/share/yarn/bin/yarn.js install --frozen-lockfile
PATH:
/usr/local/node-v12.18.0-linux-x64/bin:/software/centos7/binutils/2.30/bin:/software/centos7/ccache/3.2.2/bin:/software/centos7/cmake/3.13.2/bin:/software/centos7/gdb/8.1/bin:/software/centos7/gcc/8.2.0/bin:/home/user/bin/fzf/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/user/.fzf/bin:/usr/lib/llvm10/10.0.0/bin/:/home/user/.local/bin:/home/user/bin/fzf-0.17.5/:/home/user/bin
Yarn version:
1.22.4
Node version:
12.18.0
Platform:
linux x64
Trace:
Error: self signed certificate in certificate chain
at TLSSocket.onConnectSecure (_tls_wrap.js:1506:34)
at TLSSocket.emit (events.js:315:20)
at TLSSocket._finishInit (_tls_wrap.js:948:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:706:12)
System information:
Clangd version: 10.0.0
Operating system: CentOS 7.3
EDIT:
There is no proxy server available, that could allow to make use of http_proxy like env variables.
EDIT 2: This appeared to be an issue with yarn configuration. this question gave a hint to run yarn config set "strict-ssl" false -g, which turned off certificate checking and let me install the extension!

Related

facing an issue while creating a next.js build on ubuntu - webpack error

I am trying to build next.js app on ubuntu LTS 18.0
with node 14.18.0
also tried with node 16
but no luck!
yarn run v1.22.15
$ next build
info - Loaded env from /home/name/heb/HEB-IOT-UI/.env
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
info - Checking validity of types
warn - No ESLint configuration detected. Run next lint to begin setup
info - Creating an optimized production build
Failed to compile.
node:fs
Module build failed: UnhandledSchemeError: Reading from "node:fs" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.
> Build error occurred
Error: > Build failed because of webpack errors
at /home/name/heb/HEB-IOT-UI/node_modules/next/dist/build/index.js:397:19
at async Span.traceAsyncFn (/home/name/heb/HEB-IOT-UI/node_modules/next/dist/telemetry/trace/trace.js:60:20)
at async Object.build [as default] (/home/name/heb/HEB-IOT-UI/node_modules/next/dist/build/index.js:77:25)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I have encountered a node:fs error recently, which was resolved by going back to an even older version of Node. Perhaps try the following:
nvm install 12.14.1
nvm use 12.14.1
You may also want to try using a different version of NPM. Let me know if that helps!

How to resolve New Relic for Node.js halted startup due to an error: Error: Failed to connect to collector?

I've cloned a fully functioning repo. The project is in Typescript and I'm adding some unit tests using mocha. The project uses NewRelic and when I run the project I get the following error:
PS C:\Users\ENV\Projects\Consumer> npm start run
> wss#0.0.0 start C:\Users\ENV\Projects\Consumer
> node --inspect=5858 -r ts-node/register ./src/index.ts "run"
Debugger listening on ws://127.0.0.1:5858/e7008339-7856-4a71-9f54-acfbb1cdd93f
For help, see: https://nodejs.org/en/docs/inspector
{"app_name":"Consumer","level":"info","message":"App is running on http://localhost:3000","label":"","timestamp":"2020-07-14T13:57:48.276Z"}
New Relic for Node.js halted startup due to an error:
Error: Failed to connect to collector
at onStartConnect (C:\Users\ENV\Projects\Consumer\node_modules\newrelic\lib\agent.js:237:18)
at retry (C:\Users\ENV\Projects\Consumer\node_modules\newrelic\lib\collector\api.js:110:14)
at onPreConnect (C:\Users\ENV\Projects\Consumer\node_modules\newrelic\lib\collector\api.js:162:14)
at Immediate.setImmediate (C:\Users\ENV\Projects\Consumer\node_modules\newrelic\lib\collector\parse-response.js:62:24)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
I've done npm install. On other devices this project works just fine, so maybe I need to configure something differently on my local? I'm not sure. Also the license is correct and has been checked. Might anyone have suggestions on why I may be having this error and what I can do to fix it? Thanks!
npm install only retrieves the New Relic agent module, but you need to add the configuration like application name, and, more importantly, your license key for New Relic.
You can find all the details here: https://docs.newrelic.com/docs/agents/nodejs-agent/installation-configuration/install-nodejs-agent
So this error message is a bit misleading; the 'halted startup' referenced here is only for the New Relic agent itself, your application should continue to boot normally.
That specific error should really only appear if you don't actually have a network connection, are you sure this device was online when this happened?
I had the same issue, I removed newrelic folder from nodemodules directory and re-installed newrelic npm install newrelic --save
This solved my issue.

Installing and using npm (Node.js) module on Windows 2008 server

Can someone please advise - how to resolve this? This setup works fine locally on Windows 7 laptop, but fails on Windows 2008 server.
Here is the setup:
1. Using ASP.NET Core App and NodeServices on Windows Server 2008.
2. Installed Node.js and NPM on the server.
Logged in as one of the admin accounts "xyz". When I install a npm module - in this case, cypress test framework, it installs under the path:
C:\Users\xyz\AppData\Local
But when I run the application, it looks for the module under the path:
C:\Windows\system32\config\systemprofile\AppData\Local\Cypress\Cache\3.1.5\Cypress\
The application fails, complaining that the module is not found.
Things I tried so far:
1. Copied the cypress module directly from user localappdata folder to above location. Then it works.
2. Tried giving full path to the var cypress = require('cypress') - it finds the module, but whenever we try to use cypress, gives the same error.
3. Tried changing the nom prefix as well as cache location to the above path, but npm install cypress always installs under user's localappdata path only.
Any ideas on how to - either make the npm install, install the module at desired location. OR make the application look at the desired path?
Thanks a lot.
Here is the error:
An unhandled exception occurred while processing the request.
NodeInvocationException: No version of Cypress is installed in: C:\Windows\system32\config\systemprofile\AppData\Local\Cypress\Cache\3.1.5\Cypress
Please reinstall Cypress by running: cypress install
----------
Cypress executable not found at: C:\Windows\system32\config\systemprofile\AppData\Local\Cypress\Cache\3.1.5\Cypress\Cypress.exe
----------
Platform: win32 (6.1.7601)
Cypress Version: 3.1.5
Error: No version of Cypress is installed in: C:\Windows\system32\config\systemprofile\AppData\Local\Cypress\Cache\3.1.5\Cypress
Please reinstall Cypress by running: cypress install
----------
Cypress executable not found at: C:\Windows\system32\config\systemprofile\AppData\Local\Cypress\Cache\3.1.5\Cypress\Cypress.exe
----------
Platform: win32 (6.1.7601)
Cypress Version: 3.1.5
at raise (C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\errors.js:161:13)
From previous event:
at C:\inetpub\wwwroot\EmbeddedDashboard\node_modules\cypress\lib\errors.js:169:37
at C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\tasks\verify.js:48:60
From previous event:
at checkExecutable (C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\tasks\verify.js:43:11)
at C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\tasks\verify.js:213:12
at processImmediate [as _immediateCallback] (timers.js:383:17)
From previous event:
at Object.start (C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\tasks\verify.js:212:6)
at Object.start (C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\exec\run.js:130:19)
at C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\cypress.js:29:19
at _fileCreated (C:\inetpub\wwwroot\projectTest\node_modules\tmp\lib\tmp.js:246:7)
at FSReqWrap.oncomplete (fs.js:82:15)
From previous event:
at Object.run (C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\cypress.js:26:28)
at module.exports.cypress.run.then (C:\inetpub\wwwroot\projectTest\Scripts\RunTests.js:4:13)
at C:\Windows\TEMP\mecqsmig.e5o:166:18
at IncomingMessage.<anonymous> (C:\Windows\TEMP\mecqsmig.e5o:186:37)
at emitNone (events.js:67:13)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:905:12)
at nextTickCallbackWith2Args (node.js:474:9)
at process._tickCallback (node.js:388:17)
Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.InvokeExportAsync<T>(NodeInvocationInfo invocationInfo, CancellationToken cancellationToken)
Cypress uses cachedir to find the correct location to install Cypress into. C:\Windows\System32\config\systemprofile is the home folder of the SYSTEM user on Windows. Somehow, npm install is being executed as SYSTEM, not as your user. This would cause Cypress will attempt to install to SYSTEM's %APPDATA% directory, which is C:\Windows\System32\config\systemprofile.
This would make sense, according to the system requirements of Cypress:
Windows 7+, only 32bit binaries are provided for Windows.
I figured out how to resolve this. For some reason, when I run the application, even though it is configured to run under a service account, it still kept using the default system location for cache location.
You can configure the cache location of Cypress by setting an environment variable to your desired location. That resolved the issue for me. Here is the link to it: https://docs.cypress.io/guides/getting-started/installing-cypress.html#Binary-cache
Basically, you set a value to this environment variable CYPRESS_CACHE_FOLDER and you are set.
Hope this helps someone.

** (CaseClauseError) no case clause matching: :eacces - Building release with MIX_ENV=prod

I am not sure where to put that error, elixir, phoenixframework, or nodejs.
I am trying to create my first release build with elxir and phoenix. During the release build I see the following error. I am just not sure if this is a version/dependency problem or something that has to do with nodejs since the only information I could find related to eacces was in relationship with nodejs. Is there anything I am missing in my configuration?
Here is the error stack:
Building release with MIX_ENV=prod.
** (CaseClauseError) no case clause matching: :eacces
lib/exrm/utils/utils.ex:110: ReleaseManager.Utils.relx/5
lib/mix/tasks/release.ex:341: anonymous fn/4 in Mix.Tasks.Release.do_release/1
lib/ex_unit/capture_io.ex:146: ExUnit.CaptureIO.do_capture_io/2
lib/ex_unit/capture_io.ex:119: ExUnit.CaptureIO.do_capture_io/3
lib/mix/tasks/release.ex:340: Mix.Tasks.Release.do_release/1
lib/mix/tasks/release.ex:78: Mix.Tasks.Release.do_run/1
(mix) lib/mix/task.ex:296: Mix.Task.run_task/3
(mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2
My environment is as follows:
$ elixir -v
Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Elixir 1.3.4
$ npm --version
3.10.8
I run in a few version problems after adding exrm which I solved by adding to my dependencies the following:
{:exrm, git: "git://github.com/bitwalker/exrm.git"},
{:relx, github: "erlware/relx", override: true},
{:erlware_commons, github: "erlware/erlware_commons", override: true},
{:cf, "~> 0.2.1", override: true}
Three hours later...
I have created a fresh phoenix project using mix and could reproduce the problem. Once I added exrm I got the same error. I switchen then to distillery to see the same error. I created an issue on distillery with the hope to get there a solution. Issue 142 on distillery
EDIT:
Additional details on this issue from the distillery report:
$ uname -a
Darwin Andreass-MBP. 16.1.0 Darwin Kernel Version 16.1.0: Thu Oct 13 21:26:57 PDT 2016; root:xnu-3789.21.3~60/RELEASE_X86_64 x86_64
I am at least four levels deep in a development tree that is fully owned by my account, under my home folder.
TL;DR
This error is caused by a permission denied when attempt to write some artifact of build. You need to override EXRM with distilery and check files/directory permissions.
Long explanation
Error eacces means permission denied in Unix systems, ie, when your release task was attempting to write some builded file, this receives a permission denied from OS.
The CaseClauseError indicates that possibilty is not handled by case clausule in EXRM source code.
Anyway, EXRM was deprecated, and you need overide it with distillery

How do I get Cabal to bypass my Windows proxy settings?

When retrieving packages with Cabal, I frequently get errors with this message:
user error (Codec.Compression.Zlib:
premature end of compressed stream)
It looks like Cabal is using my Windows Networking proxy settings (for Privoxy).
From digging around Google, Cabal or its libraries appear to have (had) a problem
in this area.
Possible solutions I can see are:
Turn off proxying while using Cabal (not very keen on this one); or
Get a patch and start hacking. I'm hesitant to go down this path,
as I'm a complete Haskell noob and I'm not yet comfortable with Darcs; or
Give it the magic "can I haz no proxy" parameter. Hence the question.
If I'm reading http://darcs.haskell.org/cabal-install/Distribution/Client/HttpUtils.hs correctly, you should be able to set the environment variable HTTP_PROXY to an invalid value (would "" work?) to get it to go direct.
Following #SamB's advice, and experimenting a bit, the solution I am now using is:
export HTTP_PROXY="::"
Here's part of the experimental log:
Try #SamB's solution:
[12:10:35z ~]:export HTTP_PROXY=""
[12:11:47z ~]:set|grep HTTP
HTTP_PROXY=
[12:11:50z ~]:cabal update
Downloading the latest package list from hackage.haskell.org
cabal.exe: connect: failed (Connection refused (WSAECONNREFUSED))
Try a "reasonable person's" solution:
[12:11:54z ~]:export HTTP_PROXY="None"
[12:12:02z ~]:set|grep HTTP
HTTP_PROXY=None
[12:12:04z ~]:cabal update
Downloading the latest package list from hackage.haskell.org
cabal.exe: user error [\]
(openTCPConnection: host lookup failure for "None")
Try an "unreasonable person's" solution:
[12:23:44z ~]:export HTTP_PROXY="::"
[12:24:00z ~]:set|grep HTTP
HTTP_PROXY=::
[12:24:04z ~]:cabal update
Downloading the latest package list from hackage.haskell.org
Warning: invalid http proxy uri: "::"
Warning: proxy uri must be http with a hostname
Warning: ignoring http proxy, trying a direct connection
Note: there is a new version of cabal-install available.
To upgrade, run: cabal install cabal-install
[12:24:34z ~]:
Yay!

Resources