usmanyunusov / nano-staged

Tiny tool to run commands for modified, staged, and committed files in a GIT repository.
https://npm.im/nano-staged
MIT License
416 stars 12 forks source link

Error: spawn eslint ENOENT #8

Closed cawa-93 closed 2 years ago

cawa-93 commented 2 years ago

I'm trying to migrate the project from lint-staged to nano-staged. Installed. Replaced configuration:

  "nano-staged": {
    "*.{js,ts,vue}": "eslint --cache --fix"
  },

Run

$ npx nano-staged
Nano Staged v0.3.1
- Preparing pipeliner...
  » Done backing up original repo state.
- Running tasks...
  *.{js,ts,vue} eslint --cache --fix
- Restoring to its original state...
  » Done restoring up to its original state.
- Removing patch files...
  » Done removing up patch files.

eslint --cache --fix:
Error: spawn eslint ENOENT

This is repeated with any command

  "nano-staged": {
    "*.{js,ts,vue}": "npx eslint --cache --fix"
  },
$ npx nano-staged
Nano Staged v0.3.1
- Preparing pipeliner...
  » Done backing up original repo state.
- Running tasks...
  *.{js,ts,vue} npx eslint --cache --fix
- Restoring to its original state...
  » Done restoring up to its original state.
- Removing patch files...
  » Done removing up patch files.

npx eslint --cache --fix:
Error: spawn npx ENOENT
  "nano-staged": {
    "*.{js,ts,vue}": "npm run lint"
  },
$ npx nano-staged
Nano Staged v0.3.1
- Preparing pipeliner...
  » Done backing up original repo state.
- Running tasks...
  *.{js,ts,vue} npm run lint
- Restoring to its original state...
  » Done restoring up to its original state.
- Removing patch files...
  » Done removing up patch files.

npm run lint:
Error: spawn npm ENOENT
usmanyunusov commented 2 years ago

What is your environment?

cawa-93 commented 2 years ago
  System:
    OS: Windows 10 10.0.19044
    CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
    Memory: 9.97 GB / 15.42 GB
  Binaries:
    Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.1.0 - C:\Program Files\nodejs\npm.CMD
cinic commented 2 years ago

similar problem with husky & stylelint on Windows 10

usmanyunusov commented 2 years ago

@cinic @cawa-93

I solve the problem

cawa-93 commented 2 years ago

@usmanyunusov May u publish fix?

usmanyunusov commented 2 years ago

@cinic @cawa-93 сheck version 0.4

usmanyunusov commented 2 years ago

@cawa-93 works?

cawa-93 commented 2 years ago

@cawa-93 works?

Yeap. I successfully migrated my template to nano