Home > Net >  NPM Error: Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })
NPM Error: Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })

Time:08-12

Having an NPM error I cannot get around. Note: This project is working fine on an intel Mac but not an M2 Mac. Both NPM and Node are working with a different project. NPM Version 8.11.0 and node version 16.16.0.

This is what I get on a npm install. However trying to use npm at all within this project gives me a similar error. I've uninstalled NPM and node and reinstalled without luck.

Any ideas?

code 1
npm ERR! path /Users/andrewleonardi/Desktop/CareerTest/CareerTest/node_modules/vlc-static
npm ERR! command failed
npm ERR! command sh -c node install
npm ERR! /Users/andrewleonardi/Desktop/CareerTest/CareerTest/node_modules/which/which.js:10
npm ERR!   Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })
npm ERR!                 ^
npm ERR! 
npm ERR! Error: not found: vlc
npm ERR!     at getNotFoundError (/Users/andrewleonardi/Desktop/CareerTest/CareerTest/node_modules/which/which.js:10:17)
npm ERR!     at /Users/andrewleonardi/Desktop/CareerTest/CareerTest/node_modules/which/which.js:57:18
npm ERR!     at new Promise (<anonymous>)
npm ERR!     at step (/Users/andrewleonardi/Desktop/CareerTest/CareerTest/node_modules/which/which.js:54:21)
npm ERR!     at /Users/andrewleonardi/Desktop/CareerTest/CareerTest/node_modules/which/which.js:71:22
npm ERR!     at new Promise (<anonymous>)
npm ERR!     at subStep (/Users/andrewleonardi/Desktop/CareerTest/CareerTest/node_modules/which/which.js:69:33)
npm ERR!     at /Users/andrewleonardi/Desktop/CareerTest/CareerTest/node_modules/which/which.js:80:22
npm ERR!     at /Users/andrewleonardi/Desktop/CareerTest/CareerTest/node_modules/isexe/index.js:42:5
npm ERR!     at /Users/andrewleonardi/Desktop/CareerTest/CareerTest/node_modules/isexe/mode.js:8:5 {
npm ERR!   code: 'ENOENT'
npm ERR! }

CodePudding user response:

This was indeed a Mac M2 issue / CPU related issue.

This post saved the day: zsh: bad CPU type in executable: node

Steps to correcting:

#1: Delete package-lock.json file
#2: softwareupdate --install-rosetta

  • Related