node.jsnpmnpxnpm-startnpm-run

Unable to run npm command "Error: Command failed: npm run start"


I am trying to run a npx command on my M1 MacBook but I keep getting the same error. I already installed node.js and npm so that I could run this command:

npx @mondaydotcomorg/monday-cli scaffold run ./ quickstart-react

However, when I run this command the output is:

> Repository was downloaded successfully
> Copying the directory
> Installing packages. It can take a few moments
> Node modules were installed successfully
> Running the project
Error: Command failed: npm run start

    at ChildProcess.exithandler (node:child_process:389:12)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Socket.<anonymous> (node:internal/child_process:449:11)
    at Socket.emit (node:events:513:28)
    at Pipe.<anonymous> (node:net:757:14) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'npm run start'
}

Before, I was getting an issue saying sh: concurrently: command not found and kill-port: command not found so I installed concurrently and kill-port using npm, which removed this error messages. However, now I get the output above. I installed node.js again and updated npm version to latest version, but no change. Any suggestions on how to fix this?

Edit: I found this link that is a solution to my exact problem. (https://community.monday.com/t/monday-cli-seems-not-to-work-on-apple-m1/36745). I ran npm install kill-port and ran npm upgrade and both executed correctly. However, when I try to run npm run start command by itself, this is my output:

npm ERR! Missing script: "start"
npm ERR! 
npm ERR! Did you mean one of these?
npm ERR!     npm star # Mark your favorite packages
npm ERR!     npm stars # View packages marked as favorites
npm ERR! 
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mattspc/.npm/_logs/2022-07-18T21_08_52_459Z-debug-0.log

I think I need to find my destination folder and cd to it, then run npm run start within that folder. Any advice on how to locate it?


Solution

  • Finally figured out an answer to my own question. The main issue was my npm version and node.js version.

    To get the latest stable version of npm, run this command in terminal npm install -g npm@latest and make sure you download the correct node.js version (this one is for Apple Silicon Chip/M1, select the option on the left). Then, run nvm use --lts command in terminal to make sure you are using the correct and most stable node.js version. Finally, look in the main directory (firstnamelastname folder on Mac) and delete the quickstart-react folder if it already exists. Then, run npx @mondaydotcomorg/monday-cli scaffold run ./ quickstart-react in terminal (if there is an error message, quit terminal and reopen it, then continue with the next step). You need to run the next part locally, so do cd quickstart-react, then npm run start and it should work. If there is any error message and it says something like sh: kill-port: command not found you need to install that specific dependency within the quickstart-react folder, so search up "npm install kill-port" or "npm install ____" depending on the error, quit and reopen terminal, do cd quickstart-react and run those install commands inside the quickstart-react folder. Should work after that.

    If this doesn't work try using this link (https://community.monday.com/t/problem-to-setup-development-environment-quick-start-guide-with-cli/9422) that shows how to manually do this (this didn't work for me however).