Can't install any packages to NPM or BOWER - node.js

I have researched this extensively and nothing. So I am hoping this generates a different solution.
I keep getting this error
npm WARN packages#1.0.0 No description
npm WARN packages#1.0.0 No repository field.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "express"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! path C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe' -> 'C
:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\depd'
npm ERR! at destStatted (C:\Users\Luis\AppData\Roaming\nvm\v6.9.1\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR! at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe' -> 'C
:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\depd'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe' ->
'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\depd'
npm ERR! at destStatted (C:\Users\Luis\AppData\Roaming\nvm\v6.9.1\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR! at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\.staging\depd-974ec5fe' -> 'C
:\xampp\htdocs\nodeprojects\contact-list-app\node_modules\depd'
npm ERR! at Error (native) parent: 'packages' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! C:\xampp\htdocs\nodeprojects\contact-list-app\npm-debug.log
It's not a Mac, It's a Windows machine, so nothing to do with sudo as other responses suggested here
I don't have an antivirus running so this was a no-go too
I ran npm cache clean as suggested here and other SO solutions
It was running fine, and then it started doing this when I tried to install angular-ui-bootstrap. but I was able to install other dependencies just fine.
I also did:
Restarted my machine
used CMD as administrator
Used git bash
Used npm console
Deleted the whole thing and started again in another directory ( got desperate)
uninstalled and re-installed node.js
drank a lot of coffee, and upgraded to alcohol
Please bail me out.

I am posting this answer, simply because there isn't enough documentation on this error in the web, but please if you have other ideas you'd like to add as a possible solution (other than the ones I tried in my question) please feel free. I'm sure there are a lot of other frustrated developers looking for this. Anyway, this is how I solved it.
I deleted my node_modules folder just so I can re-install the dependencies fresh. This doesn't break anything in your project because as soon as you add them back up, they will be in the exact same place they were before. So, do n't be afraid of the 404s you will get temporarily.
Then I did a fresh install by running
npm init
This get my packages.json file going
And then I tried to install my first dependency, any dependency, pick one. But the error came up and the node_modules didn't even get started. So I got it running by installing npm in itself as a dependency. Why did this work? Beats me! But the mystic powers of node know something I don't and I am ok with that.
So I did this basically
npm install npm --save
This built my node_modules folder and I was able to install everything back. I removed the npm dependency afterwards and it's like it was never there.
Again, feel free to post any other solutions. I don't think this is a definite solution so I won't mark it. It just worked for me. Thought I shared it
EDIT
DO NOT delete that npm dependency by running npm uninstall <package> as you normally would. Instead, just delete the dependency with a good 'ol delete key

Related

What should be done to have permits to join two modules of a project without using sudo?

I am trying to link two modules created by me, in a project created with Node.js, and as always I did: npm link . inside the module that I want to call, and from the other call it in package.json, and it gives me the following error:
npm ERR! path /home/miguel/cursos/cursoJs-Node/proyectoMichaelgram/michaelgram-db
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink
npm ERR! Error: EACCES: permission denied, symlink '/home/miguel/cursos/cursoJs-Node/proyectoMichaelgram/michaelgram-db' -> '/usr/lib/node_modules/michaelgram-db'
npm ERR! { Error: EACCES: permission denied, symlink '/home/miguel/cursos/cursoJs-Node/proyectoMichaelgram/michaelgram-db' -> '/usr/lib/node_modules/michaelgram-db'
npm ERR! stack: 'Error: EACCES: permission denied, symlink \'/home/miguel/cursos/cursoJs-Node/proyectoMichaelgram/michaelgram-db\' -> \'/usr/lib/node_modules/michaelgram-db\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '/home/miguel/cursos/cursoJs-Node/proyectoMichaelgram/michaelgram-db',
npm ERR! dest: '/usr/lib/node_modules/michaelgram-db' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /home/miguel/.npm/_logs/2018-07-17T12_02_46_081Z-debug.log
How should I install Node globally?
I have seen those files and they are owned by root. I put a new version of Ubuntu 18.04 I installed node Could it be problem when installing node? I do not remember how I did it, but on previous occasions I did not have this permission problem. I do not know if I should uninstall node and npm I have to install it in a way that I can access from any project I do. I already gave another file problems and I corregi using sudo, but it does not seem like a practice, because it should not give problems, never gave them node. What do you advise me to do to correct the problem and access node_modules without using sudo? Maybe I should uninstall and install it in another way? Thank you, I hope you understand my need, forgive the syntax but I must use the translator. Thank you.
I would advice you the 2 definitive ways given in the npm documenation
1)Reinstall npm with a version manager (recommended)
2)Change npm's default directory manually.
please visit https://docs.npmjs.com/getting-started/fixing-npm-permissions

NPM is deleting old packages

Whenever I try to install a new package to my project, npm randomly deletes an old package that I have and then throws this error:
npm ERR! Error: EPERM: operation not permitted, rename 'C:\wamp\www\react_projects\Nasss\node_modules\axios' -> 'C:\wamp\www\react_projects\Nasss\node_modules\.axios.DE
LETE'
npm ERR! at moveAway (C:\Program Files\nodejs\node_modules\npm\lib\install\action\finalize.js:38:5)
npm ERR! at destStatted (C:\Program Files\nodejs\node_modules\npm\lib\install\action\finalize.js:27:7)
npm ERR! at FSReqWrap.oncomplete (fs.js:82:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\wamp\www\react_projects\Nasss\node_modules\axios' -> 'C:\wamp\www\react_projects\Nasss\node_modules\.axios.DE
LETE'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM: operation not permitted, rename 'C:\wamp\www\react_projects\Nasss\node_modules\axios' -> 'C:\wamp\www\react_projects\Nasss\node_modules\.axio
s.DELETE'] parent: 'Nasss' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! C:\wamp\www\react_projects\Nasss\npm-debug.log
Is it facing some kind of conflict with the old packages that I have installed?
P.S: I already have the CMD running as admin.
This seems like a problem with weird permissions.
It looks like npm is unable to rename the directories to other names which maybe are the old versions of the modules kept for backups if the new versions fail to get installed.
Are you sure you have the same permissions in "Program Files\nodejs\node_modules" and all of its subdirectories? It look like you may hev different permissions for existing subdirectories than you have for new subdirectories and/or the parent node_modules.
On Unix/Linux I would fix it with chmod and chown in one line but for Windows you will have to dive through the directories and examine the permissions.
O maybe you need to run as admin to update/install modules globally. It depends on your permissions and your configuration.

NPM won't install pug?

Can anyone help me decipher what this message is about?
I have another app with pug installed, yet now I cannot create a new module installation for some reason.
I'm installing pug local to the app into node_modules
I'm just trying to get work done, so if I have missed something simple, my stress level has not been helpful with keeping precise vision.
My system is for ongoing development so I don't muck around with upgrades, which historically has broken all kinds of other stuff.
My other app works fine.
# npm install --save pug#2.0.0-beta4 <= Because the working app uses this one
npm ERR! Linux 3.2.0-35-generic-pae
npm ERR! argv "/home/kingram/.nvm/v0.10.46/bin/node" "/home/kingram/.nvm/v0.10.46/bin/npm" "install" "--save" "pug#2.0.0-beta4"
npm ERR! node v0.10.46
npm ERR! npm v2.15.1
npm ERR! path /home/kingram/.npm/wordwrap/0.0.2
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! Error: EACCES, mkdir '/home/kingram/.npm/wordwrap/0.0.2'
npm ERR! { [Error: EACCES, mkdir '/home/kingram/.npm/wordwrap/0.0.2']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/kingram/.npm/wordwrap/0.0.2',
npm ERR! parent: 'cliui' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /home/kingram/node/fssreg/npm-debug.log
You may need to install using sudo, ie - sudo npm install .... This will prompt you for your root password.
It looks like root privileges are required to install the package you're looking for. Though this shouldn't really be the case, you can fix this....check out this link
After some prodding by #zillaofthegods, it turns out some of directories in ~/.npm were owned by root. In particular the wordwrap module directory.
Changed the permissions and npm installed it fine.
One of those things I would not have caught without some prodding, so thanks.

Error with installing browsersync for node js through command prompt

A little background: I have a Windows 10 laptop with 8.3 gigs of usable space(6.3 gigs are python, so 2 gigs of usable space), so I install and download everything onto an external hard drive. Unfortunately, my previous external hard drive started malfunctioning and physically falling apart after less than 6 months, so I've been in the process of moving files and reinstalling programs to my new hard drive. Recently I joined a MOOC that asked me to download Node JS and install browsersync on it.
I installed Node JS and tested it and npm with -version, and both were installed. I closed and reopened the cmd. However, when I ran npm install -g browser-sync it gave me the following: cmd errors
The first error is due to a typo, but the second error is the real one.
Here is the true error in text:
Microsoft Windows [Version 10.0.10240]
C:\Users\Bracklinn>npm install -g -browser-sync
npm ERR! addLocal Could not install C:\Users\Bracklinn
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "D:\\Programs\\NodeJs\\node.exe" "D:\\Programs\\NodeJs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "-browser-sync"
npm ERR! node v4.4.7
npm ERR! npm v2.15.8
npm ERR! code EISDIR
npm ERR! errno -4068
npm ERR! syscall read
npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Bracklinn\npm-debug.log
I tried uninstalling and reinstalling, googled it a bunch of times, and just ended up wasting 2 hours. I think it has something to do with my cmd is in my computer drive but node.js is on my hard drive. So I've turned here for help.
Thanks in advance!

Consuming node module in a tar file exposed by team city artifact

So there is currently a team city server which packages a node module for internal use and exposes it via an artifact. The artifact is a tar.gzfile which contains package.json, dist/**/*, readme.md files/folders.
In my package.json dependencies (for a dependent package) I have something like:
"some-module": "http://some-address/guestAuth/repository/download/some-project/.lastSuccessful/some-module.tar.gz"
Which resolves correctly to the tar.gz file, and I can download and open it all fine when doing it manually. However the odd thing is that when I do an npm install npm blows up with the error:
npm ERR! tar.unpack untar error C:\Users\Blah\AppData\Local\Temp\npm-10684-84325da0\some-server\guestAuth\repository\download\some-project\.lastSuccessful\some-module.tar.gz
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" "install"
npm ERR! node v4.2.6
npm ERR! npm v3.5.3
npm ERR! path C:\Users\Blah\AppData\Local\Temp\npm-10684-84325da0\unpack-f18f9e1b
npm ERR! code EEXIST
npm ERR! errno -4075
npm ERR! syscall mkdir
npm ERR! EEXIST: file already exists, mkdir 'C:\Users\Blah\AppData\Local\Temp\npm-10684-84325da0\unpack-f18f9e1b'
npm ERR! File exists: C:\Users\Blah\AppData\Local\Temp\npm-10684-84325da0\unpack-f18f9e1b
npm ERR! Move it away, and try again.
I am super confused as I have tried doing npm cache clean and deleting my temp folder in the appdata/local nothing seems to stop this error.
I have looked over lots of related issues like:
https://github.com/npm/npm/issues/6309
https://github.com/npm/npm/issues/5133
However nothing seems to work, I am on windows 10 64-bit using npm 3.5.3 and node 4.2.6.
Has anyone else achieved the same sort of thing or is there something I am missing here as it is a blocker on a current project and none of us seem to have any idea why its blowing up.
Solved it.
So the issue was that I was not putting a containing folder in my tar file, so if you add a root folder and have your package and other files underneath that, it all works.

Resources