npm install code error - angularjs

So all I am trying to do is start the tutorial for angular but I am having a biggest pain trying to install all of the programs to get going. When I put in the code "npm install" it gives me this:
$ npm install
Error: EPERM, mkdir 'C:\Program Files (x86)\Git\angular-phonecat'
at Error (native)
Error: Uncaught, unspecified "error" event.
at Error (native)
at emit (events.js:87:13)
at cleanupSync (c:\Program Files (x86)\nodejs\node_modules\npm\node_modules\
fs-write-stream-atomic\index.js:46:42)
at WriteStream.emit (c:\Program Files (x86)\nodejs\node_modules\npm\node_mod
ules\fs-write-stream-atomic\index.js:53:12)
at WriteStream.<anonymous> (evalmachine.<anonymous>:1777:12)
at OpenReq.Req.done (c:\Program Files (x86)\nodejs\node_modules\npm\node_mod
ules\graceful-fs\graceful-fs.js:141:5)
at OpenReq.done (c:\Program Files (x86)\nodejs\node_modules\npm\node_modules
\graceful-fs\graceful-fs.js:61:22)
at FSReqWrap.oncomplete (evalmachine.<anonymous>:99:15)
If someone could help that would be awesome I just want to get started on Angular.

You're trying to install to C:\Program Files (x86), which needs extra permissions. Either start your shell with admin rights, or better install it somewhere else.

I believe you need to disable AntiVirus software on Windows, and then try again.
https://github.com/Medium/phantomjs/issues/19

Related

Windows 10 -> 'npx create-react-app myapp' command does not work because of whitespace username in file path

I ran into some issues when trying to install a react app on my Windows 10 via npx create-react-app appname, receiving the following error message:
Error: EPERM: operation not permitted, mkdir 'C:\Users\Daniel'
TypeError: Cannot read property 'loaded' of undefined
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:77:20
at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:225:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:263:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach (<anonymous>)
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82:13
at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:173:20)
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98
var doExit = npm.config.loaded ? npm.config.get('_exit') : true
^
TypeError: Cannot read property 'loaded' of undefined
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at process.emit (events.js:198:13)
at process._fatalException (internal/bootstrap/node.js:496:27)
Install for create-react-app#latest failed with code 7
Solution:
I started some research and finally found out, that this issue emerges if your Windows Username has a whitespace included e.g. "C:\Users\Firstname Lastname\AppData\Roaming\npm-cache"
After some tedious hours of running in circles and re-reading multiple GitHub-threads on this issue, I finally found a patch, that worked for me:
run npm config set cache "C:\Users\Firstname~1\AppData\Roaming\npm-cache" --global from your terminal, it will replace the whitespace and everything after it with ~1, which seems to solve the issue
The source, where I found this solution is https://github.com/zkat/npx/issues/146#issuecomment-384019497
I am posting this comment here in order to save anyone the chore of working through the gazillions of circularly linked github threads.
SOLUTION
if you want to use current path that has space in username "C:\Users\Firstname Lastname\AppData\Roaming\npm-cache"
you can replace the string after space with "~1"
npm config set cache "C:\Users\Firstname~1\AppData\Roaming\npm-cache" --global
If you have still troubles with this problem you can try this:
I was able to fix this in Windows by creating a directory junction to my users folder that didn't have a space in it. You can run a command like this in an administrative powershell:
cmd /c mklink /J "C:\Users\myname" "C:\Users\My Name"
You can then use this junction as if it were your real user directory:
npm config set cache C:\Users\myname\AppData\Roaming\npm-cache
npm config set prefix C:\Users\myname\AppData\Roaming\npm
(the above should update your user .npmrc file)
Source
Here is how I solved this:
Delete npm folders from %APPDATA%
Set both prefix and cache to paths without spaces. Be aware that using prefix and cache paths out of your user's folder may expose your system to security risks.
npm config set prefix F:\PathWithoutSpace\
npm config set prefix F:\PathWithoutSpace\ --global
npm config set cache F:\PathWithoutSpace\cache
npm config set cache F:\PathWithoutSpace\cache --global
Re-install packages like yarn and creat-react-app
Add F:\PathWithoutSpace\ to your User's Path environment variable, which already includes an expanded version of %APPDATA%\npm, which will no longer be required.
I think it will be worth notifying the user of these problems when they install the NodeJS.
I did update the node version to 16.13.2 which solved the problem.
Change the NPM cache path that is not having the whitespace in the folder name. In my case I used a folder in my root of C drive .
npm config set cache C:\tmp\nodejs\npm-cache --global
In my case problem is that I am using node version of 14.18.2.
When I upgrade it to node version of 16.17.1.Then problem is resolved.

npx create react-app command doesn't work

When I run create react-app in terminal it display some errors.
npx create react-app sample
Error: EPERM: operation not permitted, mkdir 'C:\Users\Yasiru'
TypeError: Cannot read property 'loaded' of undefined
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:77:20
at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:225:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:263:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
at Array.forEach (<anonymous>)
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82:13
at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:173:20)
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98
var doExit = npm.config.loaded ? npm.config.get('_exit') : true
^
TypeError: Cannot read property 'loaded' of undefined
at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
at process.emit (events.js:196:13)
at process._fatalException (internal/process/execution.js:142:25)
Install for [ 'create#latest' ] failed with code 7
When you install create-react-app globally, you do not need to run the command with npm/npx/yarn. It is its own binary, so all you should have to type is "create-react-app directory" where 'directory' is the directory you want to create the react app within.
Also, it looks like the command you're running is "create react-app" rather than "create-react-app", make sure you do not miss the first dash or you will not be running the correct command.
delete node.js and download from node.js LTS and when you install in you computer click all the approval boxes and check the version of npm>5 and node.js and your internet ,good luck;)
Open Windows PowerShell(Admin)
then paste this and make sure to change name from Aamir~Naved to your name and similary if your name has more than one word,kindly add a tilde(~) in between:
npm config set cache "C:\\Users\\Aamir~Naved\\AppData\\Roaming\\npm-cache" --global
then paste this:(make sure to edit directory_name with name of the directory you want to create react app in. for example: C:\learnreact
npx create-react-app directory_name
I just went through this and found that all I had to do was to give write permission to the folder in which I wanted to create the app. Hope it's that simple for you.

React Native Installation

I'm trying to install React Native by following instructions on this page : https://facebook.github.io/react-native/docs/getting-started.html
but when I want to run my new project I obtain several errors and a log file is created with all what happened during the procedure.
The link to see the log : https://drive.google.com/open?id=0B8Sis1RFrKgiZTFTRWFLUmZpZlk
Thank you !
You need to install git, as you log says.
2223 error not found: git
2224 error Failed using git.
2224 error This is most likely not a problem with npm itself.
2224 error Please check if you have git installed and in your PATH.
2225 verbose exit [ 1, true ]
Here you can find how to do it:
Installing Git

Can't 'npm start' my React project [duplicate]

Get this error in windows cmd when I try to build (emulate) Cordova app.
D:\dev\Cordova\toDoList>cordova build android
Running command: D:\dev\Cordova\toDoList\platforms\android\cordova\build.bat
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:1046:32)
at child_process.js:1137:20
at process._tickCallback (node.js:355:11)
ERROR building one of the platforms: Error: D:\dev\Cordova\toDoList\platforms\android\cordova\build.bat: Command failed with exit code 1
You may not have the required environment or OS to build this project
I checked system variables one more time and found the cause of the problem:
missing C:\Windows\System32\ variable.
I added it and that solved my problem
Hope, it help you too.
just add it to the PATH: C:\Windows\System32 and start cmd as Administrator
Goto > Control Panel\System and Security\System\Advance system setting\Enviroment variable and set system variables path C:\Windows\System32\ variable and restart your System.
I know this is old but I simply had to run Visual Studio 2015 as an administrator and it worked on Windows 7.
I know its too late to answer, but incase if someone ran into trouble again.
I tried the solutions above which tells to add System32 path, But in my case the cordova path was deleted by an accident.
So I added C:\Users\Aquib\AppData\Roaming\npm\node_modules\cordova\bin to environment variable path and it worked !

Having issues opening Deployd dashboard

I am a beginner with Deployd (www.deployd.com). I am learning the book "Pro AngularJS" and I have followed at the beginning of chapter 6 all the instructions in order to open the Deployd dashboard in the browser but am getting errors at the command prompt and the dashboard's refuses to open in the browser.
The page keeps on loading till it stops and displays that the server is not found. I also followed the steps on Deployd's page and I still get the same errors.
The error I receive at the prompt is:
Unhandled rejection TypeError: Cannot read property 'insert' of undefined
at C:\Program Files\Deployd\node_modules\deployd\lib\db.js:262:8
at C:\Program Files\Deployd\node_modules\deployd\lib\db.js:155:12
at tryCatcher (C:\Program Files\Deployd\node_modules\deployd\node_modules\bl
uebird\js\main\util.js:24:31)
at Promise._settlePromiseFromHandler (C:\Program Files\Deployd\node_modules\
deployd\node_modules\bluebird\js\main\promise.js:454:31)
at Promise._settlePromiseAt (C:\Program Files\Deployd\node_modules\deployd\n
ode_modules\bluebird\js\main\promise.js:530:18)
at Promise._settlePromises (C:\Program Files\Deployd\node_modules\deployd\no
de_modules\bluebird\js\main\promise.js:646:14)
at Async._drainQueue (C:\Program Files\Deployd\node_modules\deployd\node_mod
ules\bluebird\js\main\async.js:79:16)
at Async._drainQueues (C:\Program Files\Deployd\node_modules\deployd\node_mo
dules\bluebird\js\main\async.js:89:10)
at Immediate.Async.drainQueues [as _onImmediate] (C:\Program Files\Deployd\n
ode_modules\deployd\node_modules\bluebird\js\main\async.js:14:14)
at processImmediate [as _immediateCallback] (timers.js:367:17)
Unhandled rejection TypeError: Cannot read property 'insert' of undefined
at C:\Program Files\Deployd\node_modules\deployd\lib\db.js:262:8
at C:\Program Files\Deployd\node_modules\deployd\lib\db.js:155:12
at tryCatcher (C:\Program Files\Deployd\node_modules\deployd\node_modules\bl
uebird\js\main\util.js:24:31)
at Promise._settlePromiseFromHandler (C:\Program Files\Deployd\node_modules\
deployd\node_modules\bluebird\js\main\promise.js:454:31)
at Promise._settlePromiseAt (C:\Program Files\Deployd\node_modules\deployd\n
ode_modules\bluebird\js\main\promise.js:530:18)
at Promise._settlePromises (C:\Program Files\Deployd\node_modules\deployd\no
de_modules\bluebird\js\main\promise.js:646:14)
at Async._drainQueue (C:\Program Files\Deployd\node_modules\deployd\node_mod
ules\bluebird\js\main\async.js:79:16)
at Async._drainQueues (C:\Program Files\Deployd\node_modules\deployd\node_mo
dules\bluebird\js\main\async.js:89:10)
at Immediate.Async.drainQueues [as _onImmediate] (C:\Program Files\Deployd\n
ode_modules\deployd\node_modules\bluebird\js\main\async.js:14:14)
at processImmediate [as _immediateCallback] (timers.js:367:17)
Note: any time I type a command at the Deployd console I get the following message at the prompt:
js-bson: Failed to load c++ bson extension, using pure JS version
before the results of the prompt appears. I don't know if it is also part of the problem. It is my first time trying to use Deployd so I have no clue what these errors mean.
Check your bson installation. If you have not noticed the bson errors in red letters in the console while installing
npm install deployd -g
try update with,
npm update
To get the bson package correctly installed in your system you need, python and c++ compilers in the right path in your system.
Here is the link that shows many options to get the bson package installed properly.
http://techtothepoint.blogspot.com/2015/03/npm-install-errors-buildreleasebson.html

Resources