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

[Bug] yarn build fails on a fresh clone of this repository #5657

Open
hamirmahal opened this issue Jul 3, 2023 · 15 comments
Open

[Bug] yarn build fails on a fresh clone of this repository #5657

hamirmahal opened this issue Jul 3, 2023 · 15 comments
Labels

Comments

@hamirmahal
Copy link

No description provided.

@hamirmahal
Copy link
Author

🐞 Bug report

Description

yarn build seems to fail because "prebuild": "node scripts/prebuild.js", fails.

Really long error output
$  yarn build
yarn run v1.22.19
$ node scripts/prebuild.js
Processing "/home/hamir/repositories/hint/packages/configuration-accessibility/package.json"
Processing "/home/hamir/repositories/hint/packages/configuration-all/package.json"
Processing "/home/hamir/repositories/hint/packages/configuration-development/package.json"
Processing "/home/hamir/repositories/hint/packages/configuration-progressive-web-apps/package.json"
Processing "/home/hamir/repositories/hint/packages/configuration-web-recommended/package.json"
Processing "/home/hamir/repositories/hint/packages/connector-jsdom/package.json"
Processing "/home/hamir/repositories/hint/packages/connector-local/package.json"
Processing "/home/hamir/repositories/hint/packages/connector-puppeteer/package.json"
Processing "/home/hamir/repositories/hint/packages/create-hint/package.json"
Processing "/home/hamir/repositories/hint/packages/create-hintrc/package.json"
Processing "/home/hamir/repositories/hint/packages/create-parser/package.json"
Processing "/home/hamir/repositories/hint/packages/extension-browser/package.json"
      Prebuilding...
cd /home/hamir/repositories/hint/packages/extension-browser/ && npm run prebuild
npm WARN ignoring workspace config at /home/hamir/repositories/hint/packages/extension-browser/.npmrc 

> @hint/extension-browser@2.4.14 prebuild
> npm-run-all prebuild:*

npm WARN ignoring workspace config at /home/hamir/repositories/hint/packages/extension-browser/.npmrc 

> @hint/extension-browser@2.4.14 prebuild:assets
> copyfiles -u 1 "./src/**/*.{html,json,png}" dist/bundle && copyfiles -f "./src/*.svg" dist/bundle && copyfiles -f "./src/browser-action/*.svg" dist/bundle/browser-action

npm WARN ignoring workspace config at /home/hamir/repositories/hint/packages/extension-browser/.npmrc 

> @hint/extension-browser@2.4.14 prebuild:css
> tcm src

Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/app.base.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/app.fluent.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/app.photon.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/button.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/external-docs.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/inspect-button.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/notification.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/label.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/print-link.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/radio.base.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/progress-bar.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/checkbox.base.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/radio.fluent.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/radio.photon.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/summary.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/toggle.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/valid-input.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/page.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/pages/config.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/pages/analyze.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/pages/config/example.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/external-link.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/pages/config/header.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/pages/config/section.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/pages/error.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/pages/config/sections/categories.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/pages/results.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/pages/results/category-summary.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/source-code.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/pages/results/category.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/pages/results/header.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/pages/results/message-group.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/pages/config/label.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/pages/results/problem.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/pages/results/hint.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/checkbox.fluent.css.d.ts
Wrote /home/hamir/repositories/hint/packages/extension-browser/src/devtools/views/controls/checkbox.photon.css.d.ts
npm WARN ignoring workspace config at /home/hamir/repositories/hint/packages/extension-browser/.npmrc 

> @hint/extension-browser@2.4.14 prebuild:hints
> node ./scripts/import-hints.js

Created: /home/hamir/repositories/hint/packages/extension-browser/src/shared/hints.import.ts
Created: /home/hamir/repositories/hint/packages/extension-browser/src/shared/metas.import.ts
npm WARN ignoring workspace config at /home/hamir/repositories/hint/packages/extension-browser/.npmrc 

> @hint/extension-browser@2.4.14 prebuild:i18n
> node ./scripts/create-i18n.js

Created: /home/hamir/repositories/hint/packages/extension-browser/src/shared/i18n.import.ts
Processing "/home/hamir/repositories/hint/packages/extension-vscode/package.json"
Processing "/home/hamir/repositories/hint/packages/formatter-codeframe/package.json"
Processing "/home/hamir/repositories/hint/packages/formatter-excel/package.json"
Processing "/home/hamir/repositories/hint/packages/formatter-html/package.json"
Processing "/home/hamir/repositories/hint/packages/formatter-json/package.json"
Processing "/home/hamir/repositories/hint/packages/formatter-stylish/package.json"
Processing "/home/hamir/repositories/hint/packages/formatter-summary/package.json"
Processing "/home/hamir/repositories/hint/packages/hint/package.json"
Processing "/home/hamir/repositories/hint/packages/hint-apple-touch-icons/package.json"
Processing "/home/hamir/repositories/hint/packages/hint-axe/package.json"
      Prebuilding...
cd /home/hamir/repositories/hint/packages/hint-axe/ && npm run prebuild
npm WARN ignoring workspace config at /home/hamir/repositories/hint/packages/hint-axe/.npmrc 

> @hint/hint-axe@4.4.20 prebuild
> node ./scripts/create.js

node:internal/modules/cjs/loader:446
    throw err;
    ^

Error: Cannot find module '/home/hamir/repositories/hint/node_modules/@hint/utils-types/dist/src/index.js'. Please verify that the package.json has a valid "main" entry
  at tryPackage (node:internal/modules/cjs/loader:438:19)
  at Module._findPath (node:internal/modules/cjs/loader:680:18)
  at Module._resolveFilename (node:internal/modules/cjs/loader:1063:27)
  at Module._load (node:internal/modules/cjs/loader:922:27)
  at Module.require (node:internal/modules/cjs/loader:1143:19)
  at require (node:internal/modules/cjs/helpers:110:18)
  at Object.<anonymous> (/home/hamir/repositories/hint/packages/hint-axe/scripts/create/create-metas.js:1:22)
  at Module._compile (node:internal/modules/cjs/loader:1256:14)
  at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
  at Module.load (node:internal/modules/cjs/loader:1119:32) {
code: 'MODULE_NOT_FOUND',
path: '/home/hamir/repositories/hint/node_modules/@hint/utils-types/package.json',
requestPath: '@hint/utils-types'
}

Node.js v18.16.1
npm ERR! Lifecycle script `prebuild` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: @hint/hint-axe@4.4.20 
npm ERR!   at location: /home/hamir/repositories/hint/packages/hint-axe 
/home/hamir/repositories/hint/scripts/prebuild.js:20
              return reject(new Error('NoExitCodeZero'));
                            ^

Error: NoExitCodeZero
  at ChildProcess.<anonymous> (/home/hamir/repositories/hint/scripts/prebuild.js:20:31)
  at ChildProcess.emit (node:events:513:28)
  at ChildProcess._handle.onexit (node:internal/child_process:291:12)

Node.js v18.16.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Details

I'm using WSL2 on a Windows 10 desktop device.

@hamirmahal
Copy link
Author

I'm not seeing /home/hamir/repositories/hint/node_modules/@hint/utils-types/dist/src/index.js, like the error message says.

image

@hamirmahal
Copy link
Author

I'm using version 18 of node.

$  nvm ls
->     v18.16.1
default -> lts/* (-> v18.16.1)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v18.16.1) (default)
stable -> 18.16 (-> v18.16.1) (default)
lts/* -> lts/hydrogen (-> v18.16.1)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3 (-> N/A)
lts/gallium -> v16.20.1 (-> N/A)
lts/hydrogen -> v18.16.1

@hamirmahal
Copy link
Author

I tried just now with version 16 and yarn build still failed.

$  nvm ls
->     v16.20.1
       v18.16.1
default -> lts/* (-> v18.16.1)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v18.16.1) (default)
stable -> 18.16 (-> v18.16.1) (default)
lts/* -> lts/hydrogen (-> v18.16.1)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3 (-> N/A)
lts/gallium -> v16.20.1
lts/hydrogen -> v18.16.1

@hamirmahal
Copy link
Author

This is what seems to be happening.

  1. yarn build kicks off
  2. "prebuild": "node scripts/prebuild.js",, which does
  3. cd /home/hamir/repositories/hint/packages/hint-axe/ && npm run prebuild, which does
  4. "prebuild": "node ./scripts/create.js", in packages/hint-axe/package.json, which does
  5. node packages/hint-axe/scripts/create.js, which does const { createMetas } = require("./create/create-metas");, which is a problem because

packages/hint-axe/scripts/create/create-metas.js does const { Severity } = require('@hint/utils-types'); on its first line, and Node Cannot find module '/home/hamir/repositories/hint/node_modules/@hint/utils-types/dist/src/index.js'..

@hamirmahal
Copy link
Author

As a temporary workaround, I did

  1. cd /home/hamir/repositories/hint/node_modules/@hint/utils-types and
  2. npm run build

and yarn build gets farther, but still fails later on.

@thectogeneral
Copy link

thectogeneral commented Oct 4, 2023

The reason it is failing is because you are either not using the right node version or the right npm version.

Also, you might not have sudo privileges.

As a Linux user, I use 'sudo yarn build`

I also had the same issue, and this is how I solved them.

If you keep these in checks, you shouldn't have any problem @hamirmahal

@hamirmahal
Copy link
Author

I'm using WSL2.

@hamirmahal
Copy link
Author

I get an error when I try sudo yarn build.

$  sudo yarn build
[sudo] password for hamir: 
sudo: yarn: command not found

@hamirmahal
Copy link
Author

image

@hamirmahal
Copy link
Author

What versions of node and npm are you using?

@hamirmahal
Copy link
Author

$  nvm ls
->     v18.18.0
default -> lts/* (-> v18.18.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v18.18.0) (default)
stable -> 18.18 (-> v18.18.0) (default)
lts/* -> lts/hydrogen (-> v18.18.0)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3 (-> N/A)
lts/gallium -> v16.20.2 (-> N/A)
lts/hydrogen -> v18.18.0
$  npm -v
9.8.1

@hamirmahal
Copy link
Author

image

@thectogeneral
Copy link

I get an error when I try sudo yarn build.


$  sudo yarn build

[sudo] password for hamir: 

sudo: yarn: command not found

You can install Yarn on your WSL2 and then use the node version 14

@thectogeneral
Copy link

What versions of node and npm are you using?

I use node version 14 and npm version 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants