Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm ERR! could not determine executable to run

Tags:

node.js

npm

I wanna run my project by npm run watch and when I do nothing, it suddenly appears an error like this.

git:(master) ✗ npm run watch

> watch
> npx mix watch

npm ERR! could not determine executable to run

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/bintangtobing/.npm/_logs/2021-06-04T08_11_16_499Z-debug.log

Does anyone know about these errors?

I have already did a solution, it is

delete node_modules on the project folder and run an npm install and it still got the same error.

Can anyone help me, please? Thank you, everyone.

like image 247
bintangjtobing Avatar asked Jun 04 '21 08:06

bintangjtobing


People also ask

What is NPX vs NPM?

NPM is a package manager used to install, delete, and update Javascript packages on your machine. NPX is a package executer, and it is used to execute javascript packages directly, without installing them.

How do I get NPX?

You can get npx now by installing [email protected] or later — or, if you don't want to use npm, you can install the standalone version of npx! It's totally compatible with other package managers, since any npm usage is only done for internal operations.


3 Answers

It worked for me:

npm uninstall husky && npm install --save-dev husky@4

It happens because git is trying to find a file that doesn't exist (in version 5) so downgrading helps, I know that's not the best solution but could help someone.

Or try to migrate husky (4 to 7):

https://github.com/typicode/husky-4-to-7

like image 51
Erick Gutierrez Avatar answered Oct 21 '22 12:10

Erick Gutierrez


Ended up doing

rm -rf .git/hooks
npm install

Followin this sugestion https://github.com/npm/cli/issues/1845#issuecomment-814884999

Worked for me

like image 42
Sr.PEDRO Avatar answered Oct 21 '22 14:10

Sr.PEDRO


npm install

I had this problem after trying to debug a build issue. I deleted the node_modules and ran the app in a docker container. But this meant the husky npm package wasn't available locally anymore so a simple npm install fixed the problem

like image 7
RooN3y Avatar answered Oct 21 '22 14:10

RooN3y