Getting an odd error while creating angular app with angular CLI - node.js

I've just installed nodejs and angular CLI successfully, but when I tried to create(with ng new, running the git bash with admin privileges) my first(and then second) app I got an error(same error twice: one for each new app):
Image with the error
Using windows 10, 64bit

Ok you are doing it with npm, I had faced the same error. It is due to the privileges in your system. you can run npm cache clean and try.
If that still doesnt work I suggest you try it with yarn.

Related

Electron: Unable to open X display - ERROR:browser_main_loop.cc(1400) - The futex facility returned an unexpected error code

I've been trying to run this code that brings up an electron GUI and takes input from the user. I I've used the following commands to run this project in VSCode powershell terminal:
npm install
npm start
I get the following error messages in the terminal afterwards:
Error Message 1
Error Message 2
Error Message 3
I've already checked that I have the most updated packages for nodejs, npm, electron, electron-packager and electron-builder. You can see the last three in my package.json file under the devDependencies.
Package.json dev dependencies and scripts
I don't really understand what the error is saying here. From the googling I've done, it seems like this happens on WSL when you're trying to launch an electron application but I'm working off of my local machine on Windows, so I wouldn't think that a GUI should throw an error.
I can run main.js by using electron.cmd main.js but this just brings up the GUI splash from electron but the code itself doesn't seem to be executing.
The answer in my case was switching to use Yarn instead of npm. Clearing the node modules folder and running yarn install and running election ./app from the main project folder.

React: npm start - windows cannot find localhost

I am trying to follow tutorials for basic react-build-app.
ENVIRONMENT
I am using Ubuntu on Windows 10.
Node version: v13.3.0
NPM version: 6.13.1
So far I did,
npm install -g create-react-app
create-react-app calculator
cd calculator
npm start
PROBLEM
When I run npm start, I get pop up dialog from windows saying, Windows cannot find '\https://localhost:3000/\'. Make sure you typed the name correctly, and then try again.
Here is a screenshot of the error
However, in the cli, I see
Local: http://localhost:3000/
On Your Network: http://192.168.56.1:3000/
Note that the development build is not optimized.
To create a production build, use npm run build.```
But when I open my browser and go to http://localhost:3000/, I only see a blank page, and not the normal React logo.
EXPECTED OUTPUT
I should see the react logo when going to http://localhost:3000/, and not receive and error.
ATTEMPTS
Updated nodejs and npm.
Changed ports using package.json. Also tried
using .env file to change port. Same error.
Uninstalled and re-installed ubuntu 18.04 LTS and used NVM to install nodejs and npm.
WORKAROUND
I got tired of fixing error after error with linux, so I just set up npm and nodejs on windows instead. ran create-react-app on windows cli and it worked the first time. Told me something else was listening on the port i was trying to open, so prompted me to change port. I said yes. Now I get the landing page I was looking for.
I am very new at this and have been trying to figure this out for a couple days now, I would appreciate any advice. Thank you.
This is a WSL specific issue with one of the dependencies of react-scripts, more specifically open version 7.0.0.
To resolve, you can:
switch to react-scripts 3.2.0 in your package.json, or
run npm start from something else than WSL (e.g. Powershell), or
wait for open and react to fix the issue
Bug report in React Scripts:
https://github.com/facebook/create-react-app/issues/8081
And the corresponding bug report in open:
https://github.com/sindresorhus/open/issues/154
According to this post in the bug report in open the culprit is lines 76 & 77 of index.js in node_modules/open. If you comment them out then it works fine.
Link to comment:
https://github.com/sindresorhus/open/issues/154#issuecomment-562509596

Facing error in npm install on aws ubuntu

I'm trying to deploy my angular 2 application on aws ubuntu.
I have successfully install npm on ubuntu. but by the time I'm trying to build my application on using "npm install", I'm facing "extract:typescript → gunz" error and process getting killed as shown in the attachment. Can someone please help me.?
You need to add swap on your Ubuntu
This will fix this error and npm will install all angular data successfully
follow this instructions
From here

Errors installing socket.io for node.js

I installed node on my windows 8 machine with no problems and then went to install the socket.io package to use for an assignment. After typing
npm install socket.io
I got a huge amount of errors.
What I've tried so far:
this - nodejs npm install socket.io error
and this - NPM - Can't install socket.IO
The first answer in both.
A lot of the other stuff I'm finding is for either windows 7 or Mac so I'm not sure if this is just a windows 8 thing.
As you can see in logs you have a permission error. Script doesn't have enough permissions to create directory in C:\\Program_Files\.... Use other directory instead or run command with Admin permissions.
Try running
npm install socket.io
except this time run the command line as an administrator. You can do this in Windows 8 by going to your app search, typing cmd, right-clicking then click 'Run as administrator'.
I feel this is the issue because your error message says 'Please try running this command again as root/Administrator'.

Can't deploy nodejs app to heroku and openshift

I can't deploy my ExpressJS app to Heroku or OpenShift hosting. On my MacBook Pro all works perfectly, but it go to crash when I try to deploy it on hosting.
error Error: shasum check failed for /app/tmp/npm-403-gj-8PMyB/1387967953013-0.7812028499320149/tmp.tgz
344 error Expected: f99cd60b91df7e6669c59ac2b55c4bfc65ff9494
344 error Actual: c4a5f6cf7f807d89d1aa0babe686b434426206b6
openshift log, heroku log
I had the same problem on Heroku before that I did not figure out what caused it.But this is how I fixed mine:
first remove the dependency (in your case it could be process-pwd ) from package.json file
open the terminal app on your mac and go to you project folder
run the install command for the package that fails
npm install moduleName
this will install a local copy of the module in your project folder inside node_modules folder
deploy the app again
Hope this works but you have to figure out which module actually fails :)

Resources