How to go from codepen to running locally on pc - angularjs

I would like to run the following codepen on my PC?
http://codepen.io/kyleledbetter/pen/gbQOaV
I have nodejs installed, and have exported the codepen as a zip, extracted in -
but how do i actually run it?
I have tried 'http-server ./d' ? and 'npm run serve'. Sorry this is a newb question, but I can't find documentation on web for it, or in angularmaterialwebsite.

First install http-server package npmjs.com using following command
$ npm install http-server -g
then on you run a http-server pointing to your extracted folder using following command
$ http-server path/to/your/extracted/folder -p 8989

Related

React app rewired doesnt run under port 1024

I have this React application that needs to run under port 443. Usually it works fine but now i got a new computer and for some odd reason i cant run it anymore.
I have two ways for this. A custom script in the package.json file and it should also work when ran with sudo. sudo npm start or npm run https.
The port is defined in the .env file by default.
This is what my package.json looks like
When i run sudo npm start the expected behaviour is for it to run, without sudo, it should warn me that Admin permissions are required. This is what is happening with sudo aswell.
$ sudo npm start
or with the other command
$ npm run https
Not quite sure what to do in this situation. Anyone have any idea how to make it work ?
Running this command fixed the issue for me.
sudo sysctl net.ipv4.ip_unprivileged_port_start=443

opam init fails to verify certificate

On a completely fresh ubuntu 18.04 VM I tried to install opam:
$ wget https://github.com/ocaml/opam/releases/download/2.1.0/opam-2.1.0-x86_64-linux
$ mv opam-2.1.0-x86_64-linux opam
$ chmod 777 opam
$ ./opam init
And here is the error I got
<><> Fetching repository information ><><><><><><><><><><><><><><><><><><><><><>
[ERROR] Could not update repository "default": OpamDownload.Download_fail(_,
"Download command failed: \"/usr/bin/wget --content-disposition -t 3 -O
/tmp/opam-5936-f23d09/index.tar.gz.part -U opam/2.1.0 --
https://opam.ocaml.org/index.tar.gz\" exited with code 5 \"ERROR:
cannot verify opam.ocaml.org's certificate, issued by
\226\128\152CN=Zscaler Intermediate Root CA (zscaler.net) (t)\\\\
,OU=Zscaler Inc.,O=Zscaler Inc.,ST=California,C=US\226\128\153:\"")
[ERROR] Initial download of repository failed.
How should I solve this?
I ran into the same issue and I found a workaround on the OCaml forum: here. (Credits to UnixJunkie)
You can run:
opam init github git+https://github.com/ocaml/opam-repository.git
This should avoid the certificate issues. This worked for me.
I tried to fix the certificate issues using this answer as well. You could try doing that, but it seems complicated when the workaround is to simply point it to the github repo directly.
Update
The reason opam init failed for me was because curl was installed with snap on my system.
Try to run opam init -verbose and that could reveal more about why you ran into an error.
In my case I needed to install other things with opam and it kept failing every time. So snap uninstall curl and then sudo apt install curl fixed things. (Was only able to figure this out with the help from my professor)

create-react-app not recognizable as internal or external command

I am using Git Bash terminal on my Windows 10 machine. I have below versions of node and npm
$ node -v
v12.16.1
$ npm -v
6.13.4
However while running the command $ npx create-react-app my-app I am getting the below error
'create-react-app' is not recognized as an internal or external command,
operable program or batch file.
I have added the create-react-app location till npm in PATH variable and checked its present using the echo command.
Also I am able to run the above npx command in cmd but not in Git Bash. Is there anything different I have to do run it?
PATH : /c/Users/SAURABH/AppData/Roaming/npm
I am able to run the create-react-app by doing the below though:
C:/Users/SAURABH/AppData/Roaming/npm/create-react-app one-hello-world
Not sure why npx is not working
EDIT: I solved by adding the below to PATH
C:\Users\SAURABH\AppData\Roaming\npm\node_modules
But the above path has the create-react-app folder and not the batch file. It should point to some batch file right?
I have same issue on my mac, start using yarn create react-app my-app . This solution works for me.
You should try this command with cmd or PowerShell. it's a bug with GitBash.
I can solve this error with cmd.

node HTTP-Server is not working properly?

when i install http-server in c: drive it install automatically in d: drive.
here is the result:-
C:\Users\Kuncham>npm install http-server -g
D:\usr\local\http-server -> D:\usr\local\node_modules\http-server\bin\http-server
D:\usr\local\hs -> D:\usr\local\node_modules\http-server\bin\http-server
+ http-server#0.11.1
updated 1 package in 1.131s
after installation when i run http-server in my project folder it will start the http-server and also we can access the link given in command prompt. the browser will show only files not run the my angular application.
Install http-server using npm install -g http-server command
Generate a build by using ng build --prod command
Go to dist/project_name from cmd
Type http-server -p 8080 on cmd
Type http://localhost:8080/ on browser
Perform an ng build on the directory and point your http-server at the resulting dist/ folder, which contains the compiled HTML and Javascript files your browser can consume.
More information: Angular - Deployment
I just installed http-server today and my problem was it just wasn't serving the content at all when I went to localhost:8080. The command prompt would flash for a second and disappear. I resolved my problem by hitting http://192.168.40.78:8080. http-server lists two urls you could hit. The 192 one worked, but not the localhost one.
specify the file when running http-server
http-server [path] [options]
[path] defaults to ./public if the folder exists, and ./ otherwise.

MacOS: yeoman: command not found

I know that there are many other questions towards this topic. But none of the answers helped for me :(
I simply want to do some AngularJS development using Yeoman. So here's what I did (on MacOS Yosemite):
installed Node.JS by downloading the PKG from the website
installed Yeoman by this command line npm install -g yo grunt-cli bower
When I then type yeoman or yo in the terminal, then I get -bash: yeoman: command not found error.
NodeJS is installed in /usr/local/bin/node
NPM is installed in /usr/local/bin/npm
Following other postings, I tried to change my $PATH variable but still did not work.
echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/npm:/usr/local/bin/npm/bin:/usr/texbin:/Users/mheise/.node/bin
echo $NODE_PATH (empty)
Any ideas?

Resources