error on npm start command in angular js - angularjs

I am completely new to angular js and I have started learning through this tutorial. While running the development web server using npm start I get the below error :
> angular-phonecat#0.0.0 prestart /path_to/angular-phonecat
> npm install
> angular-phonecat#0.0.0 postinstall /path_to/angular-phonecat
> bower install
> angular-phonecat#0.0.0 start /path_to/angular-phonecat
> http-server -a 0.0.0.0 -p 8000
events.js:141
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE 0.0.0.0:8000
at Object.exports._errnoException (util.js:870:11)
at exports._exceptionWithHostPort (util.js:893:20)
at Server._listen2 (net.js:1238:14)
at listen (net.js:1274:10)
at net.js:1383:9
at doNTCallback3 (node.js:452:9)
at process._tickCallback (node.js:358:17)
at Function.Module.runMain (module.js:469:11)
at startup (node.js:136:18)
at node.js:963:3
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.2.4
npm ERR! npm v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! angular-phonecat#0.0.0 start: `http-server -a 0.0.0.0 -p 8000`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-phonecat#0.0.0 start script 'http-server -a 0.0.0.0 -p 8000'.
npm ERR! This is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! http-server -a 0.0.0.0 -p 8000
npm ERR! You can get their info via:
npm ERR! npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /pathto/angular-phonecat/npm-debug.log
I have also tried changing the address and port but still the same error.
Can someone help?
PS : I am using Osx.

go to the command line and do
ps aux | grep 8000
and get PID number, should be the second column i believe, like a 5 digit number, ,then;
kill -9 <PID>
try npm start again.
I advice learning angular2 instead. As it wont be of much benefit for you learning angular 1 now.

EADDRINUSE -- this means the port which this server is trying to use is already in use by some other process so first kill it and then run your server again.

Related

github action npm run build not working, but works locally

Our team created a react web app and want to use github action to push the project to Kuberntes. Here is the Dockerfile:
### STAGE 1: Build ###
FROM node:14.5.0 as build
RUN mkdir -p /src/app
WORKDIR /src/app
# Install app dependencies
COPY package.json /src/app/
RUN npm install && \
npm install -g pushstate-server
# Bundle app source
COPY . /src/app
# Build and optimize react app
RUN npm run build:staging
### STAGE 2: Production Environment ###
FROM nginx:1.19.2
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /src/app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
when I run docker locally with command
docker build --tag abc:test .
It built the image successfully. But when I push it github action, it will stop at RUN npm run build:staging. And the Error message is
/src/app/src/Components/SideBar/SideBarLinks/index.tsx
TypeScript error in /src/app/src/Components/SideBar/SideBarLinks/index.tsx(124,9):
Property 'children' is missing in type '*** onEntered: () => void; ***' but required in type 'CollapseProps'. TS2741
122 | dropdownWrapperProps=*** 'data-tour': 'support-wrapper' ***
123 | dropdownToggleProps=*** 'data-tour': 'support-dropdown-button' ***
> 124 | collapseProps=***
| ^
125 | onEntered: () => ***
126 | const sidebarItemsWrapper = document.querySelector(
127 | '.side-bar-items-wrapper'
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! /root/.npm/_logs/2020-09-21T06_19_14_044Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! dashboard_redo#4.0.0 api:staging: `cross-env REACT_APP_API_BASE_URL=https://staging.jetsonai.com/api/v3 npm run integrations-url:staging "npm" "run" "build"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the dashboard_redo#4.0.0 api:staging 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! /root/.npm/_logs/2020-09-21T06_19_14_076Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! dashboard_redo#4.0.0 build:staging: `cross-env REACT_APP_MODE=test npm run api:staging npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the dashboard_redo#4.0.0 build:staging 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! /root/.npm/_logs/2020-09-21T06_19_14_093Z-debug.log
The command '/bin/sh -c npm run build:staging' returned a non-zero code: 1
##[error]Process completed with exit code 1.
Any idea?

Angular-seed protractor throws error

I try run angular-seed on my computer (Windows 10, last update) https://github.com/angular/angular-seed. Web works fine, but I have problem with protractor. Karma runs, but when I try protractor > npm run protractor I get these error.
E:\angular-seed>npm run protractor
> angular-seed#0.0.0 preprotractor E:\angular-seed
> npm run update-webdriver
> angular-seed#0.0.0 preupdate-webdriver E:\angular-seed
> npm install
npm WARN install Couldn't install optional dependency: Unsupported
> angular-seed#0.0.0 postinstall E:\angular-seed
> bower install
> angular-seed#0.0.0 update-webdriver E:\angular-seed
> webdriver-manager update
selenium standalone is up to date.
chromedriver is up to date.
> angular-seed#0.0.0 protractor E:\angular-seed
> protractor e2e-tests/protractor.conf.js
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
[launcher] Process exited with error code 1
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn java ENOENT
at exports._errnoException (util.js:855:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:455:9)
at process._tickCallback (node.js:369:17)
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "protractor"
npm ERR! node v5.3.0
npm ERR! npm v3.3.12
npm ERR! code ELIFECYCLE
npm ERR! angular-seed#0.0.0 protractor: `protractor e2e-tests/protractor.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-seed#0.0.0 protractor script 'protractor e2e-tests/protractor.conf.js'.
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 angular-seed package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! protractor e2e-tests/protractor.conf.js
npm ERR! You can get their info via:
npm ERR! npm owner ls angular-seed
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! E:\angular-seed\npm-debug.log
I have all up to date. I clone from git today and run npm update. It is my problem or it is package problem?
Home page of Angular seed doesn't mentioned that, but protractor has dependency on JDK. Do you have it installed? You can check this by
java --version

Unable to install Angularjs on Windows 7

While installing angularjs on windows 7. It fails with the below message:
C:\angular.js>npm install
npm ERR! git rev-list -n1 ced17cbe52c1412b2ada53160432a5b681f37cd7: fatal: bad o
bject ced17cbe52c1412b2ada53160432a5b681f37cd7
npm ERR! git rev-list -n1 ced17cbe52c1412b2ada53160432a5b681f37cd7:
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\nodejs\\\\node.exe" "C:\\nodejs\\node_modules\\npm\\bin\\npm-
cli.js" "install"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code 128
npm ERR! Command failed: git -c core.longpaths=true rev-list -n1 ced17cbe52c1412
b2ada53160432a5b681f37cd7
npm ERR! fatal: bad object ced17cbe52c1412b2ada53160432a5b681f37cd7
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! C:\angular.js\npm-debug.log
What is the reason for fatal bad object?
If you are installing angular with NPM inside the console window in an IDE like webstorm for example, you can try installing it with your powershell for example, i think that should solve this error.
Resolved!
Issue was with devDependencies "grunt-jasmine-node" mentioned in angularjs package.json file.
Changed it from "grunt-jasmine-node": "git://github.com/vojtajina/grunt-jasmine-node.git#fix-grunt-exit-code" to "grunt-jasmine-node": "~2.0.1"
grunt-jasmine-node was the referring to the fatal object

Trying to run protractor in Step 3 in angular js tutorial

I am unable to run e2e test using protractor
When I am trying to run the angular phonecat app code from https://docs.angularjs.org/tutorial
It is showing this error
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver [launcher] Process exited with error code 1
events.js:85
throw er; // Unhandled 'error' event
^ Error: spawn java 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)
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\no un" "protractor"
npm ERR! node v0.12.7
npm ERR!
npm v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! angular-phonecat#0.0.0 protractor: `protractor test/protractor-conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-phonecat#0.0.0 protractor script 'protractor test/pro
npm ERR! This is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! protractor test/protractor-conf.js
npm ERR! You can get their info via:
npm ERR! npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\xxxxx\Documents\GitHub\angular-phonecat\npm-debug.log
You have chrome and chrome driver installed?
Try this:
In 'protractor-conf.js' remove 'chromeOnly: true,' and put 'directConnect: true,'.
you can find it in angular_phonecat\test
plus, run node cmd in administrator mode. That was the missing link for me!

Installing Yeoman errors

I am new to Ubuntu and to Angular. I am attempting to set up a Yeoman framework. However each time I run the "yo" command. the following errors occur:
Error: EACCES, mkdir '/home/diarmuid/tmp/npm-2997-20XPEB7W'
npm ERR! { [Error: EACCES, mkdir '/home/diarmuid/tmp/npm-2997-20XPEB7W']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/diarmuid/tmp/npm-2997-20XPEB7W',
npm ERR! parent: 'davidmoshertutorial' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.8.0-35-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /home/diarmuid/AngularTutorial/DavidMosherTutorial
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! path /home/diarmuid/tmp/npm-2997-20XPEB7W
npm ERR! code EACCES
npm ERR! errno 3
Does anyone understand how to solve this? I tried to run "sudo yo" however I got response to :
change to change where npm stores global packages by
putting ~/npm/bin in your PATH and running:
npm config set prefix ~/npm
I ran to gedit ~/.profile and edited the file to this:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH:/~/npm/bin"
fi
I am obviously a bit lost. If anyone has any suggestions it would be much appreciated.
Run this command:
sudo chown -R `whoami` ~/tmp
the tmp folder within the home directory should be owned by the user, not by the admin.

Resources