potiuk commented on issue #44995:
URL: https://github.com/apache/airflow/issues/44995#issuecomment-3158370820

   I tried it with Airflow current .pre-commit config and we still have problem 
with `node` pre-commits
   
   When I had no node installed at all on my Linux on system level I got: 
   
   ```
   [jarek:~/code/airflow] main+ ± prefligit run --all-files
   error: Failed to install hook `compile-ui-assets`
     caused by: command `npm install` exited with an error:
   
   [status]
   exit status: 127
   
   [stderr]
   /usr/bin/env: ‘node’: No such file or directory
   ```
   
   I installed npm using regular apt (mint 21.3 cinnamon):
   
   ```
    sudo apt install npm 
   ```
   
   Then I get this:
   
   ```
   [jarek:~/code/airflow] main+ ± prefligit run --all-files
   error: Failed to install hook `lint-markdown`
     caused by: command `npm install` exited with an error:
   
   [status]
   exit status: 1
   
   [stderr]
   internal/modules/cjs/loader.js:818
   throw err;
   ^
   Error: Cannot find module 'node:path'
   Require stack:
   - 
/home/jarek/.cache/prefligit/tools/node/22.18.0-Jod/lib/node_modules/npm/lib/cli.js
   - 
/home/jarek/.cache/prefligit/tools/node/22.18.0-Jod/lib/node_modules/npm/bin/npm-cli.js
   at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
   at Function.Module._load (internal/modules/cjs/loader.js:667:27)
   at Module.require (internal/modules/cjs/loader.js:887:19)
   at require (internal/modules/cjs/helpers.js:85:18)
   at Object.<anonymous> 
(/home/jarek/.cache/prefligit/tools/node/22.18.0-Jod/lib/node_modules/npm/lib/cli.js:10:18)
   at Module._compile (internal/modules/cjs/loader.js:999:30)
   at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
   at Module.load (internal/modules/cjs/loader.js:863:32)
   at Function.Module._load (internal/modules/cjs/loader.js:708:14)
   at Module.require (internal/modules/cjs/loader.js:887:19) {
   code: 'MODULE_NOT_FOUND',
   requireStack: [
   
'/home/jarek/.cache/prefligit/tools/node/22.18.0-Jod/lib/node_modules/npm/lib/cli.js',
   
'/home/jarek/.cache/prefligit/tools/node/22.18.0-Jod/lib/node_modules/npm/bin/npm-cli.js'
   ]
   }
   
   ```
   
   I think `prefligit` should install complete node environment even if you do 
not have one installed (this is what pre-commit does) - we  actually use that 
feature in our `breeze` environment, we are using the fact that `pre-commit` 
will install the specified node version from scratch under-the-hood when it is 
used in .pre-commit-config.yml. We have a number of people who do not do UI 
development, don't have node installed and we do not want them to bother about 
it when we need to compile assets when locally installing airlfow for 
development. The nice thing about node setup done by `pre-commit` is that it 
**just works**.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to