Got a similar problem using the following setup:
- Windows 7 x64
- node v0.10.32
- npm v2.5.0
- yeoman v1.3.2
- grunt-cli v0.1.13
- grunt-html-snap v0.6.1 (grunt-html-snapshots has the same problem)
- grunt-lib-phantomjs v0.3.0 (a dependancy of grunt-html-snap(s) )
- phantomjs v1.9.15 (a dependancy of grunt-lib-phantomjs(s) )
Of less importance:
- bower v1.3.12
- git v1.9.4.msysgit.2
Error:
[email protected] install d:\TEST\a111\node_modules\grunt-html-s
napshot\node_modules\grunt-lib-phantomjs\node_modules\phantomjs
node install.js
Download already available at C:\Users\USER~1\AppData\Local\Temp\phantomjs\phan
tomjs-1.9.8-windows.zip
Extracting zip contents
Removing d:\TEST\a111\node_modules\grunt-html-snapshot\node_modul
es\grunt-lib-phantomjs\node_modules\phantomjs\lib\phantom
Copying extracted folder C:\Users\USER~1\AppData\Local\Temp\phantomjs\phantomjs
-1.9.8-windows.zip-extract-1424937053563\phantomjs-1.9.8-windows -> d:\SVN\DBITS
\Web\B-RAD\a111\node_modules\grunt-html-snapshot\node_modules\grunt-lib-phantomj
s\node_modules\phantomjs\lib\phantom
Writing location.js file
Phantom installation failed { [Error: EPERM, operation not permitted 'd:\SVN\DBI
TS\Web\B-RAD\a111\node_modules\grunt-html-snapshot\node_modules\grunt-lib-phanto
mjs\node_modules\phantomjs\lib\phantom\phantomjs.exe']
errno: 50,
code: 'EPERM',
path: 'd:\\SVN\\DBITS\\Web\\B-RAD\\a111\\node_modules\\grunt-html-snapshot\\no
de_modules\\grunt-lib-phantomjs\\node_modules\\phantomjs\\lib\\phantom\\phantomj
s.exe',
syscall: 'chmod' } Error: EPERM, operation not permitted 'd:\SVN\DBITS\Web\B-R
AD\a111\node_modules\grunt-html-snapshot\node_modules\grunt-lib-phantomjs\node_m
odules\phantomjs\lib\phantom\phantomjs.exe'
at Object.fs.chmodSync (evalmachine.<anonymous>:832:18)
at Object.chmodSync (d:\TEST\a111\node_modules\grunt-html-sna
pshot\node_modules\grunt-lib-phantomjs\node_modules\phantomjs\node_modules\fs-ex
tra\node_modules\graceful-fs\polyfills.js:141:17)
at Promise.validExit [as _successFn] (d:\TEST\a111\node_modul
es\grunt-html-snapshot\node_modules\grunt-lib-phantomjs\node_modules\phantomjs\i
nstall.js:145:8)
at Promise._call (d:\TEST\a111\node_modules\grunt-html-snapsh
ot\node_modules\grunt-lib-phantomjs\node_modules\phantomjs\node_modules\kew\kew.
js:373:13)
at Promise._withInput (d:\TEST\a111\node_modules\grunt-html-s
napshot\node_modules\grunt-lib-phantomjs\node_modules\phantomjs\node_modules\kew
\kew.js:333:25)
at Promise.resolve (d:\TEST\a111\node_modules\grunt-html-snap
shot\node_modules\grunt-lib-phantomjs\node_modules\phantomjs\node_modules\kew\ke
w.js:105:27)
at resolver (d:\TEST\a111\node_modules\grunt-html-snapshot\no
de_modules\grunt-lib-phantomjs\node_modules\phantomjs\node_modules\kew\kew.js:40
9:17)
at CB (d:\TEST\a111\node_modules\grunt-html-snapshot\node_mod
ules\grunt-lib-phantomjs\node_modules\phantomjs\node_modules\fs-extra\node_modul
es\rimraf\rimraf.js:68:5)
at Object.oncomplete (fs.js:107:15)
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "grunt-html-snapshot"
npm ERR! node v0.10.32
npm ERR! npm v2.5.0
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node install.js'.
npm ERR! This is most likely a problem with the phantomjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls phantomjs
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! d:\TEST\a111\npm-debug.log
At first I thought I solved it with the fix I posted on github HERE. On this github issue post you can also find other possible solutions.
But when I tried to generate a new project a few weeks later, I ran into the same issue...
My generator executes the following install commands:
install: function () {
var self = this,
done = self.async();
self.log(msgStepStart('------- 7: Installing! -------'));
// ---------- Generate STRUCTURE : Installation of npm packages START ---------- //
self.npmInstall([
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]', // Dependancy: [email protected]
'[email protected]'
], { 'save': true, 'saveExact': true }, function() {
done();
self.log(msgStepEnd('------- 7: I am done installing! -------'));
});
// npm save as save, saveDev or saveExact?
// --save: Package will appear in your dependencies.
// --save-dev: Package will appear in your devDependencies.
// --save-optional: Package will appear in your optionalDependencies.
// When using any of the above options to save dependencies to your package.json, there is an additional, optional flag:
// --save-exact: Saved dependencies will be configured with an exact version rather than using npm's default semver range operator.
// --save-dev-exact would be the sam as | { 'saveDev': true } => { 'saveDevExact': true }
// ---------- Generate STRUCTURE : Installation of npm packages END ---------- //
}
I also tried the phantomjs troubleshooting and none of them solved my problem.
Then when I tried to install phantomjs in an empty folder using the npm install command in gitbash and it installed without any error repeatedly.
$ npm install phantomjs
OR
$ npm install [email protected]
When I did this with grunt-lib-phantomjs, it got the same error 3 times out of 10.
$ npm install grunt-lib-phantomjs
OR
$ npm install [email protected]
And when I did this with grunt-html-snapshot, it got the same error 10 times out of 10.
$ npm install grunt-html-snapshot
OR
$ npm install [email protected]
This got me thinking. I installed phantomjs with npm on a new folder and ran my generator. This resulted in an installation without errors 10 out of 10.
To let the generator handel the complete installation I added the installation of phantomjs under the conflicts method priority of the generator to be shure it got installed before the installation of the other npm installs.
conflicts: function () {
var self = this,
done = self.async();
self.log(msgStepStart('------- 6: Handeling Conflicts! -------'));
self.npmInstall([
'[email protected]',
], {}, function() {
done();
self.log(msgStepEnd('------- 6: I handled the conflicts! -------'));
});
},
This fixed my problem completely, hope it is helpful for someone else to.
P.S.:
If you use any kind of versioning control that leaves out the installed node_modules for the deployed project. You might consider using the following in your end method priority of your generator.
end: function () {
var self = this,
done = self.async();
self.log(msgStepStart('------- 8: End! -------'));
self.spawnCommand('npm dedupe').on('exit', function(){
self.spawnCommand('npm shrinkwrap').on('exit', function(){
self.log();
self.log(clc.green('!') + clc.whiteBright(' Successfully created ') + clc.cyan(self.appTitle));
self.log(clc.green('!') + clc.whiteBright(' To see your site, run:'));
self.log('\t' + clc.yellowBright('grunt serve'));
self.log();
done();
self.log(msgStepEnd('------- 8: The End! -------'));
});
});
}
This combo will result in a deduplicated installation with fixed versions on the main and dependency levels.
This will also keep the jsphantom install on the main level and not as a dependency to avoid the error discussed. And thus will result in a clean install when you downloaded a versioned project without the node_modules folder using:
$ npm install