npm install error when following Angular2 5 min quickstart - node.js

I get an error when following the Angular2 5 min quick start. How can I get past it?
vagrant#vagrant-ubuntu-trusty-64:/vagrant/angular2-tutorial$ sudo npm install angular2-quickstart#1.0.0 /vagrant/angular2-tutorial
└── foxy#11.1.4 extraneous
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.6
npm WARN angular2-quickstart#1.0.0 No description
npm WARN angular2-quickstart#1.0.0 No repository field.
npm ERR! Linux 3.13.0-74-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/local/bin/npm" "install"
npm ERR! node v5.4.0
npm ERR! npm v3.5.2
npm ERR! path /vagrant/angular2-tutorial/node_modules/.staging/lodash-496d43d7
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename '/vagrant/angular2-tutorial/node_modules/.staging/lodash-496d43d7' -> '/vagrant/angular2-tutorial/node_modules/browser-sync/node_modules/lodash'
npm ERR! at destStatted (/usr/local/lib/node_modules/npm/lib/install/action/finalize.js:25:7)
npm ERR! at FSReqWrap.oncomplete (fs.js:82:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename '/vagrant/angular2-tutorial/node_modules/.staging/lodash-496d43d7' -> '/vagrant/angular2-tutorial/node_modules/browser-sync/node_modules/lodash'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM: operation not permitted, rename '/vagrant/angular2-tutorial/node_modules/.staging/lodash-496d43d7' -> '/vagrant/angular2-tutorial/node_modules/browser-sync/node_modules/lodash'] parent: 'browser-sync' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Linux 3.13.0-74-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/local/bin/npm" "install"
npm ERR! node v5.4.0
npm ERR! npm v3.5.2
npm ERR! path npm-debug.log.727051537
npm ERR! code ETXTBSY
npm ERR! errno -26
npm ERR! syscall rename
npm ERR! ETXTBSY: text file is busy, rename 'npm-debug.log.727051537' -> 'npm-debug.log'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /vagrant/angular2-tutorial/npm-debug.log
Here is the error log:
https://www.dropbox.com/s/xr6ha3z4re0npvi/npm-debug.log.727051537?dl=0

It looks like this is the permission issue. The npm is configured to put downloaded modules to a directory that is not authorized.
You can configure npm to install the modules to a custom directory with its prefix configuration.
Refer to following articles:
Use one of these techniques to install node and npm without having to sudo
Installing Node and npm

Related

spectral-cli instalation in ubuntu getting failed

npm install -g #stoplight/spectral-cli
Giving below error
npm WARN node-fetch#2.6.8 requires a peer of encoding#^0.1.0 but none was installed.
npm ERR! Linux 5.4.0-1094-azure
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "#stoplight/spectral-cli"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! path /usr/local/lib/node_modules/.staging/#types/node-76508090/package.json
npm ERR! code ENOTDIR
npm ERR! errno -20
npm ERR! syscall open
npm ERR! ENOTDIR: not a directory, open '/usr/local/lib/node_modules/.staging/#types/node-76508090/package.json'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Please include the following file with any support request:
npm ERR! /azp/npm-debug.log
npm ERR! code 1

install "npm install -g ionic#latest cordova" but I get errors

When I run the below command in cordova,
npm install -g ionic#latest cordova
I get the following errors -
npm WARN optional Skipping failed optional dependency /ionic/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.1.2
npm ERR! Linux 4.4.0-43-Microsoft
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "ionic#latest" "cordova"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! path /usr/local/lib/node_modules/cordova/node_modules/npm/node_modules/dezalgo
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/cordova/node_modules/npm/
node_modules/dezalgo'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/cordova/node_modules/
npm/node_modules/dezalgo']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/cordova/node_modules/npm/node_modules/dezalgo' }
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/oj1125/npm-debug.log
Can anyone help me with these errors?

On installing phonegap, I am getting an error

on installing the phonegap i am getting an error
npm ERR! Window_NT 6.1. 7600
npm ERR! argv " C:\\Program File(x86)\\node.js\\node.exe" "C:\\Users\\Abuzar\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "phonegap"
npm ERR! node v4.4.3
npm ERR! npm v3.8.8
npm ERR! path C:\Users\Abuzar\AppData\Roaming\npm\node_modules\.staging
npm ERR! code EPERM
npm ERR! erryno -4048
npm ERR! syscall un link
npm ERR! Error:EPERM: operation not permitted, unlink 'C:\Users\Abuzar\AppData\Roaming\npm\node_modules\.stagging'
npm ERR! at Error <native>
npm ERR! { [Error: EPERM: operation not permitted, unlink 'C:\Users\Abuzar
\AppData\Roaming\npm\node_modules\.stagging']
npm ERR! errno: -4048,
npm ERR! syscall:'unlink',
npm ERR! path: 'C:\\Users\\AbuzaR\\AppData\\Roaming\\npm\\node_modules\\.stagging'
}
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\aa\npm-debug.log
Please help me here,
Had the same issue.
Deleting C:\Users\[User]\AppData\Roaming\npm\node_modules\.phonegap.DELETE fixed it for me.

npm install ghost fails with code EPERM errno -4048 syscall rename (on Windows)

During the install of Ghost with npm version 3.8.x, the following errors occur:
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.8
npm WARN Gonzah#0.0.1 No repository field.
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\aosman\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "ghost"
npm ERR! node v4.3.2
npm ERR! npm v3.8.1
npm ERR! path D:\elastc-app\node_modules\ghost
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'D:\elastc-app\node_modules\ghost' -> 'D:\elastc-app\node_modules\.ghost.DELETE'
npm ERR! at moveAway (C:\Users\aosman\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:38:5)
npm ERR! at destStatted (C:\Users\aosman\AppData\Roaming\npm\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 'D:\elastc-app\node_modules\ghost' -> 'D:\elastc-app\node_modules\.ghost.DELETE'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM: operation not permitted, rename 'D:\elastc-app\node_modules\ghost' -> 'D:\elastc-app\node_modules\.ghost.DELETE'] parent: 'Gonzah' }
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! D:\elastc-app\npm-debug.log
After searching for a day to figure this out, it's apparently tied to a known bug in npm v3.8 (https://github.com/npm/npm/issues/10379#issuecomment-163316532).
The solution is to temporarily downgrade npm to v2 to perform the install. Do this:
npm uninstall npm -g
npm install npm#2 -g
npm install ghost
Then of course feel free to update npm to the latest version again.

Error: npm update

I am using vagrant to set up my enviroment, when I use sudo npm update, I get this error.
npm ERR! Linux 3.13.0-49-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "update"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! path ../mime/cli.js
npm ERR! code EPROTO
npm ERR! errno -71
npm ERR! EPROTO, symlink '../mime/cli.js'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Linux 3.13.0-49-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "update"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! path npm-debug.log.7dead0fa1a1d874805ab6e477bd46e0e
npm ERR! code ETXTBSY
npm ERR! errno -26
npm ERR! ETXTBSY, rename 'npm-debug.log.7dead0fa1a1d874805ab6e477bd46e0e'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /vagrant/myapp/npm-debug.log
NOTE1: I am using trusty32 box also I am using node 0.12, npm 2.7.4 and mongodb 2.6.
NOTE2: I can not install mongoose and the default express-generator npm modules found in the package.json
UPDATE1: Npm error when i try "sudo npm install mongoose -save"
npm ERR! tar.unpack untar error /home/vagrant/.npm/wrappy/1.0.1/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/brace-expansion/1.1.0/package
.tgz
npm ERR! Linux 3.13.0-49-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "mongoose"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! path /vagrant/myapp/node_modules/mongoose/node_modules/mongodb/node_mod
ules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_modules/node-pre-
gyp/node_modules/tar-pack/node_modules/fstream-ignore/node_modules/minimatch/tes
t/extglob-ending-with-state-char.js
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! Error: EPERM, open '/vagrant/myapp/node_modules/mongoose/node_modules/m
ongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_mo
dules/node-pre-gyp/node_modules/tar-pack/node_modules/fstream-ignore/node_module
s/minimatch/test/extglob-ending-with-state-char.js'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM, open '/vagrant/myapp/node_modules/mongoose/node_modul
es/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/nod
e_modules/node-pre-gyp/node_modules/tar-pack/node_modules/fstream-ignore/node_mo
dules/minimatch/test/extglob-ending-with-state-char.js']
npm ERR! errno: -1,
npm ERR! code: 'EPERM',
npm ERR! path: '/vagrant/myapp/node_modules/mongoose/node_modules/mongodb/node
_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_modules/node-
pre-gyp/node_modules/tar-pack/node_modules/fstream-ignore/node_modules/minimatch
/test/extglob-ending-with-state-char.js' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Linux 3.13.0-49-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "mongoose"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! path /vagrant/myapp/node_modules/mongoose/node_modules/mongodb/node_mod
ules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_modules/node-pre-
gyp/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/readable-stre
am/lib/_stream_duplex.js
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! Error: EPERM, open '/vagrant/myapp/node_modules/mongoose/node_modules/m
ongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_mo
dules/node-pre-gyp/node_modules/npmlog/node_modules/are-we-there-yet/node_module
s/readable-stream/lib/_stream_duplex.js'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM, open '/vagrant/myapp/node_modules/mongoose/node_modul
es/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/nod
e_modules/node-pre-gyp/node_modules/npmlog/node_modules/are-we-there-yet/node_mo
dules/readable-stream/lib/_stream_duplex.js']
npm ERR! errno: -1,
npm ERR! code: 'EPERM',
npm ERR! path: '/vagrant/myapp/node_modules/mongoose/node_modules/mongodb/node
_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_modules/node-
pre-gyp/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/readable-
stream/lib/_stream_duplex.js' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Linux 3.13.0-49-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "mongoose"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! path npm-debug.log.547bda60a6af6dbfaba7873fdc566e0c
npm ERR! code ETXTBSY
npm ERR! errno -26
npm ERR! ETXTBSY, rename 'npm-debug.log.547bda60a6af6dbfaba7873fdc566e0c'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Linux 3.13.0-49-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "mongoose"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! path /vagrant/myapp/node_modules/mongoose/node_modules/mongodb/node_mod
ules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_modules/node-pre-
gyp/node_modules/request/node_modules/combined-stream/node_modules/delayed-strea
m/lib/delayed_stream.js
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! Error: EPERM, open '/vagrant/myapp/node_modules/mongoose/node_modules/m
ongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_mo
dules/node-pre-gyp/node_modules/request/node_modules/combined-stream/node_module
s/delayed-stream/lib/delayed_stream.js'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM, open '/vagrant/myapp/node_modules/mongoose/node_modul
es/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/nod
e_modules/node-pre-gyp/node_modules/request/node_modules/combined-stream/node_mo
dules/delayed-stream/lib/delayed_stream.js']
npm ERR! errno: -1,
npm ERR! code: 'EPERM',
npm ERR! path: '/vagrant/myapp/node_modules/mongoose/node_modules/mongodb/node
_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_modules/node-
pre-gyp/node_modules/request/node_modules/combined-stream/node_modules/delayed-s
tream/lib/delayed_stream.js' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! tar.unpack untar error /home/vagrant/.npm/lodash._basetostring/3.0.0/pa
ckage.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/lodash._createpadding/3.6.0/p
ackage.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/lodash._createpadding/3.6.0/p
ackage.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/lodash._createpadding/3.6.0/p
ackage.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/lodash._basetostring/3.0.0/pa
ckage.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/lodash._basetostring/3.0.0/pa
ckage.tgz
npm ERR! Linux 3.13.0-49-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "mongoose"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! path /vagrant/myapp/node_modules/mongoose/node_modules/mongodb/node_mod
ules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_modules/node-pre-
gyp/node_modules/request/node_modules/har-validator/node_modules/is-my-json-vali
d/test/json-schema.js
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! Error: EPERM, open '/vagrant/myapp/node_modules/mongoose/node_modules/m
ongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_mo
dules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modules/
is-my-json-valid/test/json-schema.js'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM, open '/vagrant/myapp/node_modules/mongoose/node_modul
es/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/nod
e_modules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modu
les/is-my-json-valid/test/json-schema.js']
npm ERR! errno: -1,
npm ERR! code: 'EPERM',
npm ERR! path: '/vagrant/myapp/node_modules/mongoose/node_modules/mongodb/node
_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_modules/node-
pre-gyp/node_modules/request/node_modules/har-validator/node_modules/is-my-json-
valid/test/json-schema.js' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Linux 3.13.0-49-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "mongoose"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! path /vagrant/myapp/node_modules/mongoose/node_modules/mongodb/node_mod
ules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_modules/node-pre-
gyp/node_modules/request/node_modules/har-validator/node_modules/bluebird/js/bro
wser/bluebird.min.js
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! Error: EPERM, open '/vagrant/myapp/node_modules/mongoose/node_modules/m
ongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_mo
dules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modules/
bluebird/js/browser/bluebird.min.js'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM, open '/vagrant/myapp/node_modules/mongoose/node_modul
es/mongodb/node_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/nod
e_modules/node-pre-gyp/node_modules/request/node_modules/har-validator/node_modu
les/bluebird/js/browser/bluebird.min.js']
npm ERR! errno: -1,
npm ERR! code: 'EPERM',
npm ERR! path: '/vagrant/myapp/node_modules/mongoose/node_modules/mongodb/node
_modules/mongodb-core/node_modules/bson/node_modules/bson-ext/node_modules/node-
pre-gyp/node_modules/request/node_modules/har-validator/node_modules/bluebird/js
/browser/bluebird.min.js' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! tar.unpack untar error /home/vagrant/.npm/ansi-styles/2.0.1/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/has-ansi/1.0.3/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/strip-ansi/2.0.1/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/escape-string-regexp/1.0.3/pa
ckage.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/supports-color/1.3.1/package.
tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/graceful-readlink/1.0.1/packa
ge.tgz
npm ERR! Please include the following file with any support request:
npm ERR! /vagrant/myapp/npm-debug.log
UPDATE2: Switching to nvm works better with npm update but i cant not install mongoose i got the same error
UPDATE3: I think the problem is because the path
You are using an older version of NPM, the current latest version is 2.8.4 you are currently on 2.7.4. The release notes for 2.7.5 mention an issue with symbolic links that was fixed.
Updating NPM should fix this, run:
sudo npm install npm -g
There are two problems with using sudo with npm
99 problems like this.
It's a security issue.
The best solution is to use a node version manager. I use nvm. Another called n exists as well.
It felt like a couple steps "backwards" and I resisted it for a week or two, but making the switch was worth it.
NOTE: You should uninstall your "sudo" version of node.js, then install nvm as described on the github page.
Here 2.1.7 is the version you want to install.
sudo npm install -g npm#2.1.7

Resources