Angular - Error: spawn cmd ENOENT - angularjs

Hi I have problem when I generate angular - yo angular.
I'm all done. Running bower install & npm install for you to install the required dependencies. If this fails, try running the command yourself.
invoke angular:route
invoke angular:controller:C:\Users\david\AppData\Roaming\npm\node_modules\generator-angular\route\index.js
create app\scripts\controllers\about.js
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
Anyone show me how to solve this issue? Thanks.

Im not sure why this error comes about, however i managed to run my Angular application by running with : ng serve instead of ng serve --open . Please not you will need to copy the url manually and place it in the browser afterwards which should be http://localhost:4200/

I got the same issue for windows 8 and tried several installations after doing changes to AppData/Roaming folder. None of the solutions worked for me. The issue is because of an environment variable of your system path is missing . Add "C:\Windows\System32\" value to your system PATH variable.

this error occurs when your terminal is not having access to open browers or admin permision try running your terminal as admin

I've got this issue after updating Angular CLI to 11.0.2 and I've been spent a lot of time to resolve this,
Apparently, I've tried the default port to serve my project and it served without any errors. which is http://localhost:4200/ but, I needed to run on http://localhost:8000/ So I did this....
First of all try remove node_modules from your directory and re-install npm packages. (I'm saying this because, some users got resolved the issue) to re-install npm packages, run
npm i
or run below command
npm install
if this didn't work, try adding the port number to the angular.json file.
search for serve options in the json file.
then add your desired port number like this "port": 8000,
(P.S. 'WorkspaceUI' means my project name and I've been trying to run on '8000' port. you can run on your own port number.) Then run your project using ng serve command. Thank you!

There are many guesses on different portal for this error and none of them works. Here is the solution -
Run this command to install angular cli before performing anything -
npm install -g #angular/cli

Related

whenever I try to run my project I keep getting the development server returned http response code 500 for url in react native

this problem occurred after deploying sanity to my project(I don't know if its the source of the problem but just wanted to share it.)
[This is what I see in the emulator]
(https://i.stack.imgur.com/otbGz.png)
and the following is what appears in the terminal:
Error: Duplicated files or mocks. Please check the console for more info
at setModule (/home/faisalmwy/development/react-native/food-delivery/node_modules/metro-file-map/src/index.js:553:17)
at workerReply (/home/faisalmwy/development/react-native/food-delivery/node_modules/metro-file-map/src/index.js:624:9)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 27260)
at /home/faisalmwy/development/react-native/food-delivery/node_modules/metro-file-map/src/index.js:395:22
at DependencyGraph.ready (/home/faisalmwy/development/react-native/food-delivery/node_modules/metro/src/node-haste/DependencyGraph.js:94:5)
at Bundler.ready (/home/faisalmwy/development/react-native/food-delivery/node_modules/metro/src/Bundler.js:75:5)
at IncrementalBundler.ready (/home/faisalmwy/development/react-native/food-delivery/node_modules/metro/src/IncrementalBundler.js:327:5)
at Server.ready (/home/faisalmwy/development/react-native/food-delivery/node_modules/metro/src/Server.js:1247:5)
I've searched for this problem before, some said delete the package-lock.json and node_modules, but it didn't work. others said reinstall npm all together. that didn't work also. I also tried running the app on a different localhost that usual, since sometimes me and a friend of mine connect in the same time.
Have you tried to stop the application and do the below process:
cd android and gradlew clean
remove node_modules and package-lock.json
run npm i
also remove application from simulator or from your device
rerun application

.net core 3.1 (React) app does not work after deployment

I published an app which works perfectly, when I start it directly from the publish folder.
but after deploying it to IIS server through IIS Manager, it gives this error:
InvalidOperationException: The NPM script 'start' exited without indicating that the create-react-app server was listening for requests. The error output was: npm ERR! code ENOENT
tried many fixes like:
deleting node_modules,
deleting package-lock.json,
then running npm install, re-deployement..
tried npm run build.... no errors.
no luck yet, full error screenshot below.
looks like the issue was, after deployment, app was still set to development mode..
found out it was a problem inside web.config, so I removed this line in my web.config
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
another more of a forced solution is to put a line under startup.cs => Configure Method
env.EnvironmentName = "Production";

Installing “atom-beautify#0.33.4” failed

when trying to install atom-beautify package, i have the following error.
npm ERR! Unexpected end of JSON input while parsing near '...concat":"latest","#ty'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HP.atom.apm_logs\2021-02-14T07_09_54_821Z-debug.log
i made sure, the atom version is up to date, windows firewall is off, antivirus is off
pls help me to fix this issue. thanks.
delete the .apm folder inside the .atom folder
Thank you
you might be wondering where the apm folder is
you'll find it in the last options in the settings named open config folder with a link opening sign tap on it wait for another page to load,right there you would see different folders.look for the apm folder and delete it.restart your atom app and try installing the beauty package.hope it works for you

npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/react-is (over 30000ms)

When I want to create a react app I'm encountering the following error:
npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/react-is (over 30000ms)
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\info\AppData\Roaming\npm-cache\_logs\2020-04-23T02_54_45_865Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting app2/ from C:\Users\info
Done.
Sounds like you have a slow connection. Try increasing the timeout from 30s to 60s by adding this to your .npmrc file:
timeout=60000
You could also try adding
prefer-offline=true
if you are trying to save bandwidth or have a slow connection
Note: if you don't have an .npmrc file setup yet, you can create one here
for Windows: C:\Users\{username}\.npmrc
for Mac/Linux ~/.npmrc
Or you can create one in the same directory as your project's package.json file.
I had a slow connection and I updated the timeout value to .npmrc using:
npm set timeout=100000
And to check if the value is updated (Mac): vi ~/.npmrc
Users are extremely likely to face this issue if they are on a slow internet connection. To counter this, you need to increase the timeout in the npm's config file. And here's how to do it:
Find the .npmrc file (located in the nodejs installation folder; in my case, it's in F:\Installations\nodejs\node_modules\npm folder. But for you, it might be in C:\program files folder).
Open the .npmrc file and append this line: timeout=240000 (usually it is 60 seconds I suppose, but since my connection was way slower therefore, I had to increase it to 240 seconds or 4 minutes, you can keep it 120000 for 120seconds)
Save the file
Since create-react-app fails midway, it can easily break npm's package.json file thus leading to this sort of issue:
Unexpected end of JSON input while parsing near
Therefore, before running the npx create-react-app, run the following command: npm cache clean --force as it cleans the cache and (i think) repairs the package.json file.
I was facing the same issue. I Solved it like this:
create a new file with no name just an extinction of .npmrc
open this file in any editor and type timeout = 90000
save the file and in you terminal type
npm cache clean --force
npm install create-react-app
npx create-react-app ./
Note: this error occurs because of slow internet speed
This error occurs due to slow internet connection. Try installing when you get a better speed. If better speed doesn't solve your problem try this.
npm cache verify
npm cache clean --force
I enabled IIS and the issue was solved for me:
do to Control Panel -> Programs -> Programs and Features
click on Turn Windows features on and off
make sure the Internet Information Services is checked
click OK and wait for some minutes
I was facing the same issue when create a react-app using npx create-react app . And i fixed my problem by running the following command.
npm cache clean --force
I hope you find this helpful
I fixed the problem by setting timeout in user local .npmrc file to
timeout=600000
90000 is not enough for downloading many packages for projects with lot dependencies in package.json
In case you are still running into this issue below with the error:
Invalid response body while trying to fetch
https://registry.npmjs.org/eslint-config-react-app: Socket timeout
Run this script: npm install react --registry=https://registry.npmjs.org
and then npx create-react-app mypp
for your react app installation. Happy coding
I fixed the problem by running:
npm config set registry "http://registry.npmjs.org" --global
It appears the problem is related to the following post:
npm install gets stuck at fetchMetadata
And #CptUnlucky's solution worked for me on macOS Catalina 10.15.7, node v16.0.0, npm v7.12.2, nvm v0.38.0
I was facing the same issue and I solved it by enabling the Internet Information service (IIS) feature of the window.
Enabling the IIS
Steps:
Windown + r
Type appwiz.cpl and click OK
click on Turn window features on or off (on the Left top side)
wait some seconds and check the Internet information service option
Now wait until window apply changes.
create project again.
I have faced the same issue. I tried all solutions over StackOverflow or Github discussions but nothing worked.
I changed the .npmrc file under the Users folder in C in Windows and changed the timeout from 30000 to 90000. See if 60000 works!
In my case it was the issue related to npm verison 6.14*
Downgrading to npm verison 6.13.7 solved for me
npm i -g npm#6.13.7
It's also an newly opened issue
you can check more details about it at
https://github.com/npm/cli/issues/1185
You just need to run npm i npm#6.13.7 or npm I -g npm#6.13.7 if you wanna this to be global version.
After that, just to make sure, run " npm -version " to see what version you are using.
Downgrading to npm version 6.13.7 worked for me.
Try this:
npm cache clean --force
npm config rm proxy
npm config rm https-proxy
And remove your node_modules within your user.
In Windows, it is
C:\Users\${select_your_user}\AppData\Roaming\npm\node_modules
I was facing the same issue when running npm install on Docker.
I had to pass the HTTP and HTTPS proxy values to the image while building it.
docker build --build-arg HTTP_PROXY=http://<your_company_proxy> --build-arg HTTPS_PROXY=http://<your_company_proxy>
It worked fine after I passed these parameters.
In my case it was the issue related to npm verison 6.14*
Downgrading to npm verison 6.13.7 solved for me
npm i -g npm#6.13.7
It's also an newly opened issue you can check more details about it at https://github.com/npm/cli/issues/1185
it is works for me
Editing the .npmrc file to 80000 works. If not, globally uninstall create-react-app:
"npm uninstall -g create-react-app" then run "npx create-react-app ./"
I recently have the same issue and following steps would help you.
npm config set registry "http://registry.npmjs.org" --global (sets registry) (Try Again)
Go to you user folder find .npmrc file there and remove content of it.
run npm cache clean --force
still errors - Remove the content of npm base folder usually inside User/AppData/roaming/npm/...
I tried everything including factory resetting my Mac. Then after reinstalling everything and still having the same issue, I typed into the terminal and ran:
npm set timeout=100000
then sat my computer next to my router and ran npx create-react-app again and it worked!
Sometimes it won't work if you use only letters in your app name e.g first I have used "myapp" and that was not working though I have done all the other stuffs correctly like set timeout = 240000 in .npmrc file and run the following commands
npm cache clean --force
npm install create-react-app
npx create-react-app myapp
but that not working for me then I have just changed my project name from myapp -> my-app and it worked perfectly. So, If you are facing the same issue try them out. Hopefully, it saves your time.
I tried many things for 3 days, then i figure out that new versions of nodejs doesn't work so fine for some computers, i downgrade to 16.0.0 and then worked
Regarding npx ...
If you have create-react-app (CRA) globally installed;
it is recommend you uninstall CRA
to ensure that npx always uses the latest version.
When using npx, the global installation isn't used.
But it may interfere (addressed below).
Don't run your React app from your desktop.
Some operating systems may throw an error.
Windows OS users ...
As administrator (for steps #1 & #2), inside your command-line ...
1) uninstall your global version of CRA.
npm uninstall -g create-react-app Mac prefix: sudo
2) Then ...
Run: npx create-react-app my-app Mac prefix: sudo
Above: This will create the latest version of
a React app named: my-app.
This app will be created wherever your command-line is pointing.
3) Open Google Chrome.
4) cd my-app (point your command-line to your project folder).
5) inside your command-line ... Run: npm start

Unbale to run angular-material docs locally

I'm trying to run Angular-Material docs locally. I followed the instructions mentioned in the link
material/docs at master
Successfully executed npm install without errors (but with npm version warning - I'm just considering that thsi) after lots of googling and looking at SO answers.
When I execute bower install it throws the following error.
G:\Angular\material-master\docs\app>bower install
bower ENOENT No bower.json present
When I googled it I just got this link https://github.com/angular/material/issues/2407 saying
we no longer use bower within the /angular/material repository. Now you use only need to use npm.
And if I proceed to gulp docs I again get the error as below:
G:\Angular\material-master\docs\app>gulp docs
[19:37:47] Working directory changed to G:\Angular\material-master\docs
[19:37:48] Using gulpfile G:\Angular\material-master\docs\gulpfile.js
[19:37:48] Task 'docs' is not in your gulpfile
[19:37:48] Please check the documentation for proper gulpfile formatting
Where am I going wrong, how do I get it working? Any help is appreciated.
PS: I am not a pro at using node or at using angular. I also tried HTTPster method mentioned alternatively, but no luck.
G:\Angular\material-master\docs\app>httpster -p 8080 -d ./dist/docs
Starting HTTPster v1.0.1 on port "8080" from ./dist/docs
GET / 404 10ms
GET /index 404 2ms
GET /demo 404 2ms
GET /help 404 1ms
And also tried the same from root directory with a random hope, but just got same results.
My questions is not similar to
Not able to run angular material docs on locally which states a different error.
Looks like your installation is not complete. Please follow the steps.
Step 1: Get the Master Project by using git https://github.com/angular/material.git. OR Clone it locally.
Step 2: Run npm install.
Step 3: gulp build & gulp docs (install gulp first if you don't have).
Step 4: gulp server. (This start project at localhost:8080).
Sometimes it causing problem to run u can alternatively run it by going one step further.
Install http-server by using following command.
npm install http-server -g
then run using http-server dist/docs -p 8080 -a 127.0.0.1
Project available at http://localhost:8080/

Resources