Unable to run npm command "Error: Command failed: npm run start" - node.js

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?

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).

Related

React npm start issue -- ELIFECYCLE, errno1

Any time I try to run npm start I get an error saying:
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! dbproject#0.1.0 start: set PORT=9999 && react-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the dbproject#0.1.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
So far I've tried:
-Changing environment variables, my current environment variables are these
-Cleaning the npm cache, deleting the node_modules and then running npm install again
-I tried running npm start in different project folders, none of the React projects work, they all throw the same error. Node servers run well, I haven't tried running anything else.
Pastebin of the full console log: https://pastebin.com/P8DDDaDq
Pastebin of the debug.txt file: https://pastebin.com/1ebezKX2
I'm running Windows 10 Home Build 17134.
I would be extremely grateful of any help
Problem solved!
Leaving the solution that worked for me here in case it is helpful for anyone.
Here's what I did:
1.- Uninstall node
2.- Restart your computer
3.- Install node again
4.- Install React running npm install -g create-react-app
5.- Create a new React project folder running npm create-react-app yourProjectName, place all your project files here except for the node_modules folder and the package.json files
6.- After you have done that install all of your dependencies manually with npm, it should work fine now!

npm start not working for react native setup

Hei,
I'm new to programming and trying to Setup my toolchain and create a new React Native project.
If needed, install code editor (+ extensions), git, npm
Install the Expo app to your phone. iOS or Android
Use the expo CLI tool to generate an app skeleton
Create a folder for your React Native projects
use Git Bash or terminal to go to this folder cd foldername/otherfoldername/etc...
npm install -g expo-cli
expo init MyApp --npm
choose 'blank' template
if this fails on Windows due to missing interactive mode, use cmd instead of Git Bash
Test that app works; run it and open in the browser (the interactive shell is needed to get the menu option (w) for launching in browser)
cd MyApp
npm start <---
From now on open 'MyApp' folder in your editor/IDE to edit your project
Create a remote git repository (Github) and push your app there
I have done these but I get this error when I write in my VScode npm run
expo start
Starting project at C:\Users\35845\Documents\ReactNativeProject\MyApp
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
Error: spawn powershell ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)* at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: expo start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\35845\AppData\Roaming\npm-cache_logs\2020-08-26T08_53_44_736Z-debug.log
Can someone please help me with this. Thank you
use cmd instead of git bash or PowerShell on windows and try below steps and run:-
Delete node_modules folder
run npm cache clean --force
npm install
expo start
make sure you are inside your application folder (where package.json is present)

error: This is probably not a problem with npm. There is likely additional logging output above

In my project, I'm using Angular6 for the frontend. Now what I'm trying to do is deploy my project which is in remote server into the actual server. I'm using npm run build -prod command to build the frontend first. But I can't build my project since the following error occurs again and again,
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! Trackit-Revamp#6.0.0 build: `ng build --prod --build-optimizer --aot`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the Trackit-Revamp#6.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Indrajith.E\AppData\Roaming\npm-cache\_logs\2019-08-22T08_41_00_271Z-debug.log
My error log in the C:\Users\Indrajith.E\AppData\Roaming\npm-cache\_logs\2019-08-22T08_41_00_271Z-debug.log file path contains the same error details mentioned above.
How can I resolve this problem?
Delete your package-lock.json file and node_modules folder.
Then do npm cache clean
npm cache clean --force
do
npm install
again and run
Finally, I found a solution to this problem without reinstalling npm and I'm posting it because in future it will help someone,
Most of the time this error occurs javascript heap went out of the memory. As the error says itself this is not a problem with npm. Only we have to do is
instead of,
npm run build -prod
extend the javascript memory by following,
node --max_old_space_size=4096 node_modules/#angular/cli/bin/ng build --prod
Please delete package-lock.json and clear npm cache with npm cache clear --force
and delete whole node_modules directory
Finally install or update packages again with npm install / npm update
You can also add any new packages with npm install <package-name>
This fixed for me.
Thanks and happy coding.
I'm on Ubuntu 18.04. I fixed this problem by increasing the inotify max_user_watches using this command:
echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
I'm new with react... Well i had the same output:
Starting the development server...
events.js:196
throw er; // Unhandled 'error' event
^
Error: ENOSPC: System limit for number of file watchers reached, watch '/opt/lampp/htdocs/react-tuto/public'
at FSWatcher.<computed> (internal/fs/watchers.js:168:26)
at Object.watch (fs.js:1351:34)
at createFsWatchInstance (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:38:15)
at setFsWatchListener (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:81:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:233:14)
at FSWatcher.NodeFsHandler._handleDir (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:429:19)
at FSWatcher.<anonymous> (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:477:19)
at FSWatcher.<anonymous> (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:482:16)
at FSReqCallback.oncomplete (fs.js:165:5)
Emitted 'error' event on FSWatcher instance at:
at FSWatcher._handleError (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/index.js:260:10)
at createFsWatchInstance (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:40:5)
at setFsWatchListener (/opt/lampp/htdocs/react-tuto/node_modules/chokidar/lib/nodefs-handler.js:81:15)
[... lines matching original stack trace ...]
at FSReqCallback.oncomplete (fs.js:165:5) {
errno: -28,
syscall: 'watch',
code: 'ENOSPC',
path: '/opt/lampp/htdocs/react-tuto/public',
filename: '/opt/lampp/htdocs/react-tuto/public'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-tuto#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-tuto#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/paulo/.npm/_logs/2019-12-16T16_46_27_856Z-debug.log
I just tried:
sudo npm start
And it worked.
I already have the same problem . and I fix it using npm update & npm cache clean --force
Delete node_modules
rm -r node_modules
install packages again
npm install
Delete node_module directory and run below in command line
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
If still not working, try below
npm install webpack --save
For me, the problem was in firebase.json, the site name was incorrect.
For the people it didn't work, I spent two days finding the solution and there was just one command that worked like a magic.
npm install -g live-server
and then run: npm start
it will start as normal.You can read all the details here https://www.npmjs.com/package/live-server
Deleting the package-lock.json did it for me. I'd suggest you not push package-lock.json to your repo as I wasted hours trying to npm install with the package-lock.json in the folder which gave me helluva errors.
Check if port you want to run your app is free. For me, it was the problem.
Following steps solves my problem:
Add "C:\Windows\System32\" to your system path variables
Run npm eject,
Run npm start,
Run npm eject,
and agian run
npm start
And it worked😊
For me, I was trying to install an old version of bcrypt which was not found in npm, I just edited package.json and manually put the latest version and then ran npm install and it worked
first delete the file (project).
then rm -rf \Users\Indrajith.E\AppData\Roaming\npm-cache_logs\2019-08-22T08_41_00_271Z-debug.log (this is the file(log) which is showing error).
recreate your project for example :- npx create-react-app hello_world
then cd hello_world.
then npm start.
I was also having this same error but hopefully after spending 1 day on this error i have got this solution and it got started perfectly and i also hope this works for you guys also...
I had encountered the same error. And, I just simply deleted the whole node_modules folder, and installed the npm packages again solved my error.
Delete node_modules (don't worry you have package.json)
npm install
Novice mistake. Make sure your package.json file is coded correctly. I had:
"start": "index node.js"
instead of:
"start": "node index.js"
17
Delete your package-lock.json file and node_modules folder. Then do npm cache clean
npm cache clean --force
do npm install
I just do two steps:
first:
export METEOR_ALLOW_SUPERUSER=true;
second:
sudo systemctl stop bbb-html5
and finally:
npm start
My project is on wagtail. I solved this problem by running the following command:npm update & npm cache clean --force
I had the issue in React. In my case it was happening, because I didn't see warnings/errors above the message. After fixing the issues, everything worked properly. Hopefully it's going to help someone.
On Ubuntu, I restarted the server and the problem was solved.
For me, it happens because of the low version of Node. Upload my Node version and it worked successfully.

Can anyone explain this error when I run "npm run ng new app"?

So I'm trying to make a new angular app for the first time, and I installed it using npm i -g #angular/cli. When I try to make a new app using npm run ng new app, it gives me this error:
npm ERR! path E:\ddii\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'E:\ddii\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users...\AppData\Roaming\npm-cache_logs\2018-09-10T20_22_50_118Z-debug.log
In short, you are running the command incorrectly. Remove the npm run from the front of your command, and it should work.
When you say npm run blah, npm does a lookup in your package.json for a script called blah or in your case ng. So... if you are running npm run ng new app, npm wants there to be a package.json in your current directory, and in that package.json, npm expect a script called ng. So if you don't have a package.json in your current dir, then you are going to get an error.
Instead, close your terminal, and open a new terminal and run simply ng new app.
I struggled to find this answer myself, as the other answers on this question do not address the real underlying issue.
All the other answers suggest to install ng GLOBALLY using (npm i -g ...), with the side effect that a symlink to ng will be on your PATH.
Based on OP's question, I do concede he was most likely attempting to scaffold a new Angular app from the GLOBALLY installed ng. So this handles 90% of people's questions, and is all fine and nice.
I, however, want to use the LOCALLY INSTALLED ng, which is why I have an npm-script in my package.json for it:
{
...
"scripts": {
...
"ng": "ng",
...
}
If this describes your use case like it does mine, then read on.
npm run ng update succeeds for me, whereas other more complex commands with more arguments—including command-line switches—fail outright (npm run ng -- update #angular/cli --migrate-only tslint-version-6).
The answer lies in that you must delimit the start of arguments being passed to npm run-script with -- (see https://stackoverflow.com/a/14404223/1438576):
npm run ng -- update #angular/cli --migrate-only tslint-version-6
So in OP's case, assuming he already had a locally-installed copy of ng with a package.json (which I admit is doubtful), he could have done:
npm run ng -- new app
Anyway, hope this helps others.
If you want to run it without the npm run ..., you need to install ng globally, I would do npm install -g #angular/cli, however I'm running linux, for windows I've found this thread ng is not recognized as an internal or external command
It should help you install a global version of angular-cli, you'll basically do two things:
Install globally angular-cli (if you don't have it).
Make sure it's in your environment variable's PATH.
Check the question answers, details are there.
Could help for future references
At least for me this work.
Sometimes, the reference to the file ng.cmd (in case of Win users) is not well formed and you have to call it and pass the arguments directly
e.g.
< path-where-ng.cmd-file-is-located >\ng.cmd new app
Running calling ng.cmd file directly
It says: ' "ng" is not recognized as an internal or external command, operable program or batch file.'
And it works even if you do not have admin permissions for any reason

"Permission Denied" in Node on Linux, when running start-script /w local nodemon/mocha/babel-node

I'm having issues with my new linux setup - I've installed nodemon as a local dependency (NOT globally) and I'm trying to execute it from my package.json "start"-script. I'm getting this permission error.
node by itself works great, but as soon as I try to use babel-node or nodemon or even mocha, I get permission problems.
My setup is divided across 2 hard drives - node is installed on my SSD (with my OS), and my project (and it's node_modules, where I'm trying to execute nodemon from is on my storage-HDD.
sh: 1: nodemon: Permission denied
npm ERR! Linux 3.19.0-56-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v5.9.0
npm ERR! npm v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! vyggo-easyrtc#1.0.0 start: `nodemon --exec node entry`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the vyggo-easyrtc#1.0.0 start script 'nodemon --exec node entry'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the vyggo-easyrtc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! nodemon --exec node entry
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs vyggo-easyrtc
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls vyggo-easyrtc
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /media/goatic/HDD/Projects/Node/vyggo-easyrtc/npm-debug.log
goatic#goatic-laptop:/media/goatic/HDD/Projects/Node/vyggo-easyrtc$
I had this problem after changing moving my project from an NTFS filesystem to linux. I changed all the file/directory permissions to 644/755 and also set the owner/group. That's when I started getting this error.
When I tried nodemon in the terminal, I got command not found. Strange.
Reinstalling nodemon fixed it:
sudo npm install -g nodemon
My secondary drive was incompatible with my linux OS in terms of permissions, as it was an NTFS partition.
I ended up moving everything to my primary drive, and of course permissions were working again, allowing me to execute local dependencies.
I guess the solution to my problem, had I relied on keeping projects on the secondary drive, would be to format it to a format compatible with Linux permissions.
If you are installing in MAC Use.
sudo npm install -g nodemon --unsafe-perm.
It will work.
I had the same problem. In my case when I changed my operating system to Linux Ubuntu, 20.04.1 Version, reinstalling nodemon solved the problem.
For Linux users:
sudo npm install -g nodemon
for Windows users, open a new terminal or cmd prompt just write:
npm install -g nodemon
For more information check nodemon documentation:
nodemon documentation
I counter this problem when I git clone a project which initially created on a Windows machine, my simple solution is to delete the .node_modules directory and then run npm install, which solved my problem.
very weird, I had the same problem except I solved it by replacing Nodemon devStart with nodemon devStart and suddenly the error was gone :)

Resources