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

fix: custom-checks script from package.json does not work #1809

Closed
Leeyoungone opened this issue Jan 21, 2022 · 6 comments · Fixed by #1965
Closed

fix: custom-checks script from package.json does not work #1809

Leeyoungone opened this issue Jan 21, 2022 · 6 comments · Fixed by #1965
Labels
bug Something isn't working dependencies Pull requests that update a dependency file

Comments

@Leeyoungone
Copy link
Contributor

Leeyoungone commented Jan 21, 2022

Description

Running yarn custom-checks returns an error:

TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module "file:///Users/youngonelee/cactus/tools/custom-checks/run-custom-checks.ts" 
    at new NodeError (node:internal/errors:371:5)
    at ESMLoader.load (node:internal/modules/esm/loader:324:13)
    at async ESMLoader.moduleProvider (node:internal/modules/esm/loader:230:47)
    at async link (node:internal/modules/esm/module_job:67:21) {
  code: 'ERR_INVALID_MODULE_SPECIFIER'
}
 1: 0x101c462b5 node::Abort() [/usr/local/bin/node]
 2: 0x101c4797c node::errors::TriggerUncaughtException(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 3: 0x101e25368 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/bin/node]
 4: 0x101e24e36 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
 5: 0x101e2456f v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
 6: 0x102682379 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/usr/local/bin/node]
 7: 0x102614d6a Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
 8: 0x1026445c7 Builtins_AsyncFunctionAwaitRejectClosure [/usr/local/bin/node]
error Command failed with signal "SIGABRT".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@Leeyoungone Leeyoungone added bug Something isn't working dependencies Pull requests that update a dependency file labels Jan 21, 2022
@zondervancalvez
Copy link
Contributor

@Leeyoungone can you provide the steps to replicate this? Thank you.

@petermetz
Copy link
Contributor

@Leeyoungone can you provide the steps to replicate this? Thank you.

@zondervancalvez You can do yarn custom-checks (a prerequisite is to have ran the configure script successfully once prior)

@ruzell22
Copy link
Contributor

Hello @petermetz , can you assign this ticket to me? Thank you.

@ruzell22
Copy link
Contributor

ruzell22 commented Mar 3, 2022

@petermetz As for this issue, the first solution that I have found that results to a non-error one, is reverting back to older node version.

(https://stackoverflow.com/questions/63807613/running-node-with-loader-ts-node-esm-js-requires-imports-to-have-the-js-extensi)
Based on this discussion, they used v14.15.0 and it fixed their problem. I have tried using the same version and the result was a success.
image
However, we are using v16.13.1 for cactus right now so we just put this solution on hold and looked for more solution to make it work on v16.

I also tried adding "type": "module" and changing "module": "ESNext" into "module": "commonjs" but the result is still an error.
(TypeStrong/ts-node#1171)

(egoist/esbuild-register#22)
According to this, they used v16.4.1. I tried it and it resulted to a success.
image

(TypeStrong/ts-node#1522)
(nodejs/node#40504)
In here, the version checks for v16 are working up until v16.12.0. Something closer to the current one we are using which is v16.13.1. I have tried v16.12.0 and it resulted to an error.
image

However, v16.11.0 resulted to a success. The closest to v16.13.0 that is a success custom-checks.
image

Is it possible to bump down the node version from v16.13.1 to v16.11.0 ? Thank you.

@petermetz
Copy link
Contributor

@petermetz As for this issue, the first solution that I have found that results to a non-error one, is reverting back to older node version.

(https://stackoverflow.com/questions/63807613/running-node-with-loader-ts-node-esm-js-requires-imports-to-have-the-js-extensi) Based on this discussion, they used v14.15.0 and it fixed their problem. I have tried using the same version and the result was a success. image However, we are using v16.13.1 for cactus right now so we just put this solution on hold and looked for more solution to make it work on v16.

I also tried adding "type": "module" and changing "module": "ESNext" into "module": "commonjs" but the result is still an error. (TypeStrong/ts-node#1171)

(egoist/esbuild-register#22) According to this, they used v16.4.1. I tried it and it resulted to a success. image

(TypeStrong/ts-node#1522) (nodejs/node#40504) In here, the version checks for v16 are working up until v16.12.0. Something closer to the current one we are using which is v16.13.1. I have tried v16.12.0 and it resulted to an error. image

However, v16.11.0 resulted to a success. The closest to v16.13.0 that is a success custom-checks. image

Is it possible to bump down the node version from v16.13.1 to v16.11.0 ? Thank you.

@ruzell22 Could you please double check if this works with Node 16.13.1 or newer? https://github.com/TypeStrong/ts-node/tree/main/esm-usage-example
If that usage example works then we can piggy back on that to update our scripts/config files in a similar fashion to make it work without having to downgrade the NodeJS version (which is problematic because then we have to update the documentation everywhere to state that certain NodeJS minor versions are not supported when working on the Cactus codebase)

@petermetz
Copy link
Contributor

petermetz commented Apr 9, 2022

@ruzell22 I took a stab at it just now and managed to get it to work with (seemingly) all v16.. versions by upgrading the ts-node dependency from "10.2.0" to "10.7.0". Please update your PR to include that as the fix instead of changing the NodeJS versions. This way people won't have to wonder what's going wrong if they happen to be on a NodeJS 16 minor version that the old version of ts-node does not work with.

Make sure to

  1. run yarn after updating the root package.json file with the new dependency version. This will trigger the update to the yarn.lock file as well.
  2. Also make sure that there is no other changes in the diff of your PR apart from the package.json and the yarn.lock file.

ruzell22 added a commit to ruzell22/cactus that referenced this issue Apr 11, 2022
petermetz pushed a commit to ruzell22/cactus that referenced this issue Apr 12, 2022
petermetz pushed a commit that referenced this issue Apr 13, 2022
fixes: #1809
Signed-off-by: ruzell22 <ruzell.vince.aquino@accenture.com>
micoferdinand98 pushed a commit to micoferdinand98/cactus that referenced this issue May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants