Skip to content

node compat: support npm scripts lifecycle #20137

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

Closed
sigmaSd opened this issue Aug 11, 2023 · 1 comment
Closed

node compat: support npm scripts lifecycle #20137

sigmaSd opened this issue Aug 11, 2023 · 1 comment

Comments

@sigmaSd
Copy link
Contributor

sigmaSd commented Aug 11, 2023

https://docs.npmjs.com/cli/v9/using-npm/scripts#life-cycle-operation-order

tree-sitter uses install.js for example, to reproduce the issue

mkdir a && cd a && npm init
npm install --save-dev tree-sitter-cli
# modify package.json to include "scripts": {"ts":"tree-sitter"}

npm ts -h works
deno task ts -h errors:

Warning Currently only basic package.json `scripts` are supported. Programs like `rimraf` or `cross-env` will not work correctly. This will be fixed in an upcoming release.
Task ts tree-sitter "-h"
error: Uncaught NotFound: Failed to spawn: /home/mrcool/dev/deno/lab/tmp/JbS/a/node_modules/.deno/[email protected]/node_modules/tree-sitter-cli/tree-sitter: No such file or directory (os error 2)
    at spawnChildInner (ext:runtime/40_process.js:162:17)
    at spawnChild (ext:runtime/40_process.js:182:10)
    at Command.spawn (ext:runtime/40_process.js:440:12)
    at new ChildProcess (ext:deno_node/internal/child_process.ts:110:16)
    at spawn (node:child_process:104:12)
    at Object.<anonymous> (file:///home/mrcool/dev/deno/lab/tmp/JbS/a/node_modules/.deno/[email protected]/node_modules/tree-sitter-cli/cli.js:7:1)
    at Object.<anonymous> (file:///home/mrcool/dev/deno/lab/tmp/JbS/a/node_modules/.deno/[email protected]/node_modules/tree-sitter-cli/cli.js:13:4)
    at Module._compile (node:module:731:36)
    at Object.Module._extensions..js (node:module:745:12)
    at Module.load (node:module:656:34)

The problem is the tree-sitter package have an install.js that needs to be called automatically to download ts binary

@lucacasonato
Copy link
Member

Duplicate of #16164

@sigmaSd sigmaSd closed this as completed Aug 14, 2023
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

No branches or pull requests

2 participants