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. >>
(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.
Created attachment 210277 [details] log for build failure of vscode Attached is the log for build failure of vscode.
(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?
Yes, it does on my system.
(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.
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.
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
(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"?
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
(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.
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
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.
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)
'pkg add' of the latest txz worked. Thanks !
May I close this bug?
Sure. Please go ahead.
Hello, Seems to came back with latest version (1.53.2): I had to change `/usr/ports/editors/vscode/work/vscode-1.53.2/build/npm/postinstall.js` file, line 24 from: ``` const passargs = ['--ignore-optional', '--frozen-lockfile', '--ofiline-mode', '--no-progress', '--verbose']; ``` into ``` const passargs = ['--ignore-optional', '--frozen-lockfile', '--no-progress', '--verbose']; ``` IE, remode `--offline-mode`` Sorry to reopen this issue. Jacques Foucry
(In reply to Jacques Foucry from comment #17) I can't reproduce the error by doing "make build" or building with poudriere. Can you share how you tried to build the port? FYI: It was reported recently a similar issue was resolved by "doing full clean-up of /usr/local and rebuilding all packages." https://lists.freebsd.org/pipermail/freebsd-ports/2021-February/120289.html
I also encountered the same issue now.
"make clean configure make-yarn-cache clean build" did the trick for me.
(In reply to Koichiro Iwao from comment #20) After the recent update to 1.55.0, I encountered this issue again. Performing "make configure make-yarn-cache" did the trick again.
Created attachment 234950 [details] Fix build on base system with ${LOCALBASE}/share/.yarnrc existing Building editors/vscode on the base system fails if other ports have created a file ${LOCALBASE}/share/.yarnrc that defines yarn-offline-cache overriding the .yarnrc definition of this port. I did not check why this is not an issue for build/npm/preinstall.js, but build/npm/postinstall.js prefers the .yarnrc in ${LOCALBASE}/share and then fails to find the required dependencies in ${LOCALBASE}/share/yarn-offline-cache. The attached patch makes yarn use the port's .yarnrc instead of the one in the base system directory and thus fixes the build in the scenario outlined above.
(In reply to Stefan Eßer from comment #22) Thanks a lot for the patch! Could you tell me which port have created ${LOCALBASE}/share/.yarnrc so that I can double-check the issue has been solved? (I grep'ed the ports directory but could not find a pkg-plist containing .yarnrc.)
Created attachment 234951 [details] Fix build on base system with ${LOCALBASE}/share/.yarnrc existing The previous patch used a relative path to the .yarnrc file, which did not work in sub-directories of "extensions". Update to use an absolute path instead.
(In reply to Hiroki Tagato from comment #23) I do not know which port might have created /usr/local/share/.yarnrc and fetched the files into /usr/local/share/yarn-offline-cache. Since I had removed "--offline" from the vscode build before, there were a number of vscode dependencies (dating back to 2020, since I had used the work-around since then). I'll watch these locations to see whether they are recreated when I update other ports that use yarn. But I have verified that moving /usr/local/share/.yarnrc out of the way fixes the vscode build, as does commenting out setting the yarn cache variable in that file. Passing the path to the correct .yarnrc fixes the issue in any case, independently if other .yarnrc files on the system. But IMHO no port should put files into /usr/local/share without those file being registered in the package database, much less files that are only required at build time. I'll open PRs for those other ports that put files into those directories ...
(In reply to Stefan Eßer from comment #24) Great! I double-checked the patch works on my environment. Would you like to commit the patch?
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=5b2cbb7be2922fb35dd827a4a17ab1c04c23db58 commit 5b2cbb7be2922fb35dd827a4a17ab1c04c23db58 Author: Stefan Eßer <se@FreeBSD.org> AuthorDate: 2022-07-09 01:51:16 +0000 Commit: Hiroki Tagato <tagattie@FreeBSD.org> CommitDate: 2022-07-09 01:51:16 +0000 editors/vscode: fix build with ${LOCALBASE}/share/.yarnrc existing PR: 242936 Reported by: bourne.identity@hotmail.com, jacques+freebsdbugzilla@foucry.net, meta editors/vscode/files/patch-build_npm_postinstall.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Committed, thanks!