Angularjs Project run localmachine - angularjs

I wanna run this project using Node.js. I have already installed it. But I don't know how to run it in my local system. Any help is appriciated.

install a simple http-server by following command
npm install -g http-server
go to project main folder where index.html exists and run command
http-server
You can start your project at locathost:8080

Related

zsh: command not found: netlify on mac OS

I am trying to deploy basic react-app to netlify. I ran these commands to install and deploy application
npm install netlify-cli -g
netlify deploy
It throws:
zsh: command not found: netlify error.
I am working on mac OS. What is causing this issue?
It basically means your zshrc does not have npm binary directory in the PATH. Make sure that you have that squared away.
Are you using brew or nvm to install npm?
Correction
You have to install netlify-cli as well. That gives you the netlify command.
npm install -g netlify-cli
Go to folder:
/Users/<user>/.npm-global/lib/node_modules/
And delete any files/folders pertaining to Netlify. For exmaple folder named:
netlify-cli
Then reinstall the cli using
npm install netlify-cli -g
try this:
step 1: re-run the netlify-cli installation command to get the path where cli is installed
step 2: test the version using the full path where the cli is installed, it'll confirm that netlify-cli is working
step 3: add the npm directory link to your zsh environment variable PATH
Use the main Terminal(not the integrated terminal of your text editor) when installing the netlify-cli.
npm install -g netlify-cli
I had installed it multiple times in the integrated terminal of VS code but all in vain.Success came after using the Terminal.

React serve -s build, The term 'serve' is not recognized as the name of a cmdlet

Hello I am trying to build my react app so I did yarn build and it created the necessary folder now I am trying to do serve -s build and it's telling me the error below
** I have tried to uninstall and reinstall serve by npm uninstall -g serve and npm install -g serve
and I found the serve folder in C:\Users\Nairi\AppData\Roaming\npm\node_modules
Try npx serve -s build I don't know why but they happened to me also and this worked
Solution1:
yarn global add serve
Based on NPM - Doc, you can install it globally yarn global add serve, then use it as you want like serve -s build
Solution2: npx:
npx serve -s build
As this article says, npx will check whether <command> or <package> exists in $PATH, or in the local project binaries(node_modules), and if so it will execute it, and if it's not there, it will download it. You can also run packages from github
Check your admin permissions, so it can install globally with the -g flag
I don't know if anyone still needs this but you can use this
yarn global add serve - Once this is successful, do yarn serve -s build. This worked for me!

Install env-cmd on github

I'm manually setting up the environment variable depending what build I'am using ( QA or PROD ) and I'm using github actions to deploy my qa build..
So change the script from npm run build to env-cmd -f ./.env.qa node scripts/build.js.
The problem is env-cmd is not installed on github and I can't seem to find the github action to install it. For now when it tries to build it says env-cmd: not found
Have you installed it before trying to call it? npm install env-cmd or npm install -g env-cmd.
https://www.npmjs.com/package/env-cmd

create-react-app command not found in ubuntu 16.04 LTS

I tried to install create react app using sudo npm install -g create-react-app on my terminal, then this message appeared:
/home/mahi/.npm-global/bin/create-react-app -> /home/mahi/.npm-global/lib/node_modules/create-react-app/index.js
+ create-react-app#1.4.3
updated 1 package in 11.7s
Then when I am going to run the command create-react-app hello-world, it says create-react-app command not found. Then I searched for many solutions, I tried almost all of them, but nothing improved, showing the command not found again and again.
I had this same problem and this is how I solved it.
It will work on Ubuntu 16.04 as well as Ubuntu 18.04.
First, open up terminal and run this command:
sudo npm install -g -y create-react-app
After that, you will be able to use the create-react-app anywhere on your machine because it is saved globally.
Are u sure to run npm install with sudo? I had same problem and terminal couldn't write to folder with commands. Does your /usr/local/lib/node_modules/ folder contains create-react-app?
are you using create-react-app with sudo? because if you installed the package using sudo npm install create-react-app then it is installed for this user, try sudo create-react-app and if it works then you should change ownership to your user
I use to have the same problem in the terminal when i write npm install -g create-react-app and them create-react-app my-first-app.
So i went react doc and i find npx create-react-app my-first-app that worked for me.
Hope that will help.
If you read carefully then you will see after installing Yarn it tells you to add the following thing in your path.
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
~/.yarn/bin is for yarn binaries only.
Try it!
Source: https://github.com/yarnpkg/yarn/issues/5156

gh-pages failing while trying to deploy Reactjs app to GitHub in windows 10

I tried following the exact instructions listed in the react documentation on how to deploy a working app to github pages. When I ran npm run deploy. It kept failing at the gh-pages -d build saying that the 'gh-pages' is not an internal or external command. I made sure I had the latest versions of node and npm installed
I had installed gh-pages using the -g tag to make it globally available. Tried adding to the system path variable leading to the node modules folder where i knew gh-pages was loaded. Still nothing.
Finally i tried running it from the git bash window instead of the cmd terminal. This hadn't occurred to me at first as all of the other npm commands worked. Don't know why this fixed things but it did. Just posting this so somebody else might be spared the pain
I had the same issue but finally managed to make it work. The main issue was that I hadn't installed Git for Windows, but I took some extra steps to make sure everything works fine.
Download and install Git for Windows from here
Run npm cache clean to clean npm cache
Run npm install npm#latest -g to install the latest version of npm
Add "homepage" : "http://myname.github.io/myapp", to
"package.json" file and replace the URL with correct GitHub pages URL. If you are not sure about the URL, open the project repository in the browser and go to "Settings" tab. Scroll down and find correct URL under "GitHub Pages".
Run npm install --save-dev gh-pages to install gh-pages module
Add the following 2 lines to "scripts" object in "package.json" file:
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
Finally, run npm run deploy to create an optimized production
build and deploy it on GitHub pages. If you haven't logged in to
Github for windows app before, Github app pops up and asks you to enter your username and password. When you've done that the deploy process will continue and uploads the production build on GitHub pages.
Hope that helps, happy coding.
If it says this, then node_modules/.bin/gh-pages doesn't exist (no, you don't need to install it globally). If it doesn't exist, then it means you either forgot to run npm install --save-dev gh-pages, or something went wrong during the installation.
I would not recommend installing it globally (although looks like it worked in your case).

Resources