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

Cannot run CI compatible install script #1356

Closed
starnayuta opened this issue Jan 25, 2024 · 0 comments · Fixed by #1357
Closed

Cannot run CI compatible install script #1356

starnayuta opened this issue Jan 25, 2024 · 0 comments · Fixed by #1357

Comments

@starnayuta
Copy link
Contributor

The installation scripts compatible with CI need to be modified for these reasons.

Must indicate ES Modules because it uses top-level await

PS C:path\to\directory> npm i

> directory@1.0.0 prepare
> node .husky/install.js

C:path\to\directory\.husky\install.js:5
const husky = await import('husky')
              ^^^^^

SyntaxError: await is only valid in async functions and the top level bodies of modules
    at internalCompileFunction (node:internal/vm:77:18)
    at Module._compile (node:internal/modules/cjs/loader:1340:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.11.0
npm ERR! code 1
npm ERR! path C:\path\to\directory
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node .husky/install.js

husky() is not a function, so it must use husky.default()

PS C:path\to\directory> npm i

> directory@1.0.0 prepare
> node .husky/install.mjs
file:///C:/path/to/directory/.husky/install.mjs:6
husky()
^

TypeError: husky is not a function
    at file:///C:/path/to/directory/.husky/install.mjs:6:1

Node.js v20.11.0
npm ERR! code 1
npm ERR! path C:path\to\directory
npm ERR! command failed

CI checks should be fixed

According to ci-info, when we use process.env.CI, we should use !!(process.env.CI !== 'false' && process.env.CI).

https://github.com/watson/ci-info/blob/v4.0.0/index.js#L56-L69

@starnayuta starnayuta changed the title The installation scripts compatible with CI need to be modified Cannot run CI compatible install script Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant