Bug 242936 - editors/vscode: Fails to build: yarn attempts to fetch dependency in offline mode (typscript)
Summary: editors/vscode: Fails to build: yarn attempts to fetch dependency in offline ...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords: needs-patch
Depends on:
Blocks:
 
Reported: 2019-12-28 08:01 UTC by bourne.identity@hotmail.com
Modified: 2020-03-21 17:29 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (tagattie)


Attachments
log for build failure of vscode (11.94 KB, text/plain)
2019-12-28 10:19 UTC, bourne.identity@hotmail.com
no flags Details
log for patch and build of vscode (3.75 KB, text/plain)
2019-12-30 09:31 UTC, bourne.identity@hotmail.com
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description bourne.identity@hotmail.com 2019-12-28 08:01:51 UTC
Hi,

On an 12.1 AMD64 box, I am trying to build editors/vscode from ports with all default config options on.


After a few hours of compilation, I get this :


<<

$ yarn --frozen-lockfile --offline
yarn install v1.16.0
warning package.json: No license field
warning vscode-extensions@0.0.1: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
error Can't make a request in offline mode ("https://registry.yarnpkg.com/typescript/-/typescript-3.7.3.tgz")
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

>>
Comment 1 Hiroki Tagato 2019-12-28 10:12:20 UTC
(In reply to bourne.identity@hotmail.com from comment #0)

Can you post a while build log?
It appears yarn somehow can't find modules cache location.
Comment 2 bourne.identity@hotmail.com 2019-12-28 10:19:33 UTC
Created attachment 210277 [details]
log for build failure of vscode

Attached is the log for build failure of vscode.
Comment 3 Hiroki Tagato 2019-12-29 11:48:21 UTC
(In reply to bourne.identity@hotmail.com from comment #2)

There is nothing suspicious in the build log and I can't reproduce the error.

Does the file "typescript-3.7.3.tgz", which yarn tries to download, exist in ${WRKDIR}/yarn-offline-cache?
Comment 4 bourne.identity@hotmail.com 2019-12-29 12:33:55 UTC
Yes, it does on my system.
Comment 5 Hiroki Tagato 2019-12-30 07:42:32 UTC
(In reply to bourne.identity@hotmail.com from comment #4)

I still can't reproduce the error. But can you try the following procedure?

1. make patch

2. edit ${WRKSRC}/.yarnrc
Change the line:
yarn-offline-mirror "/usr/ports/editors/vscode/work/yarn-offline-cache"
to:
yarn-offline-mirror "../yarn-offline-cache"

3. make build

Accoding to the URL: https://yarnpkg.com/en/docs/yarnrc#toc-yarn-offline-mirror, the value of "yarn-offline-mirror" must be a relative path and having used an absolute path may have something to do with the error.
Comment 6 bourne.identity@hotmail.com 2019-12-30 09:31:52 UTC
Created attachment 210325 [details]
log for patch and build of vscode

No, doesn't work for me.

1) Ran 'make patch'
2) There is no ${WRKSRC}/.yarnrc but there is a work/vscode-1.41.0/.yarnrc. I patched that file. I presume you meant the same.
3) Ran 'make build'

I get pretty much the same error as before. Kindly refer attachment.
Comment 7 bourne.identity@hotmail.com 2019-12-30 10:26:16 UTC
I now think the problem is not with the port but with my system. Before building the port, I had git cloned vscode from the web and then ran 'make install' inside the cloned directory. That build failed with a different sequence of errors, but I think installed many binaries and modules including yarn and node on my system. These would conflict with the standard /usr/ports/editors/vscode port. So when I run 'make install' inside the port, I am almost certain to get unpredictable results. I deleted as many previously standing modules (yarn, node) from the git clone, but continue to get the same error when I run 'make install' inside the port.

You certainly would not be able to reproduce the error I get and probably should mark this bug request as closed. If you could still give me a tip how I can recover from this disaster, I shall be grateful.

Thanks,
Manish Jain
Comment 8 Hiroki Tagato 2019-12-30 12:05:07 UTC
(In reply to bourne.identity@hotmail.com from comment #7)

I'm not sure but the system-wide yarn cache may have something to do with the error.

Can you try "yarn cache clean" before "make install"?
Comment 9 bourne.identity@hotmail.com 2019-12-30 13:17:54 UTC
Does not work in numerous ways I tried. I probably will have to wait for vscode pkg to become available. Any further tips are welcome. I also sent a related question to freebsd-questions, which I separately emailing to you.

Thanks,
Manish Jain
Comment 10 Hiroki Tagato 2019-12-30 13:48:45 UTC
(In reply to bourne.identity@hotmail.com from comment #9)

Try again to set POUDRIERE option OFF (using make config) and "make install".

That will allow yarn to access network during build. So the "offline mode" error should go away by the workaround.
Comment 11 bourne.identity@hotmail.com 2019-12-30 14:26:28 UTC
Very, very close to success. vscode builds nicely but the installation fails:

===>  Installing for vscode-1.41.0
===>  Checking if vscode is already installed
===>   Registering installation for vscode-1.41.0
pkg-static: Unable to access file /usr/ports/editors/vscode/work/stage/usr/local/share/code-oss/resources/app/extensions/ms-vscode.references-view/dist/extension.js.map:No such file or directory
*** Error code 74

Stop.
make[1]: stopped in /usr/ports/editors/vscode
*** Error code 1
Comment 12 bourne.identity@hotmail.com 2019-12-30 14:33:44 UTC
I also checked the dist directory (/usr/ports/editors/vscode/work/stage/usr/local/share/code-oss/resources/app/extensions/ms-vscode.references-view/dist). The file extension.js exists, but extension.js.map does not exist.
Comment 13 Hiroki Tagato 2020-01-01 06:43:37 UTC
Just FYI, a binary package of vscode is already available in the latest branch of pkg set.
(See http://pkg.freebsd.org/FreeBSD:12:amd64/latest/All/)

I guess vscode pkg will be available shortly in the quarterly (default) branch as well.

If you want to try the pkg now and don't mind switching to the latest branch, try the steps at:
https://wiki.freebsd.org/Ports/QuarterlyBranch (Switching from quarterly to latest)
Comment 14 bourne.identity@hotmail.com 2020-01-03 20:04:56 UTC
'pkg add' of the latest txz worked. Thanks !
Comment 15 Luca Pizzamiglio freebsd_committer 2020-03-21 15:58:40 UTC
May I close this bug?
Comment 16 bourne.identity@hotmail.com 2020-03-21 16:28:35 UTC
Sure. Please go ahead.