Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm install fails when phantomjs package is a listed dependency - Please try running this command again as root/Administrator #1205

Closed
benlaan opened this issue Feb 10, 2016 · 6 comments

Comments

@benlaan
Copy link

benlaan commented Feb 10, 2016

I am using phantomjs for testing, so it is part of my package.json. but when using a hosted agent, I get the following errors:

[command]C:\Program Files\nodejs\npm.cmd install
...
> [email protected] install C:\a\1\s\Client\node_modules\phantomjs-prebuilt
> node install.js
Found PhantomJS at C:\NPM\Modules\phantomjs.CMD ...verifying
Writing location.js file
PhantomJS is already installed on PATH at C:\NPM\Modules\phantomjs.CMD
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! path C:\NPM\Cache\concat-map\0.0.1\package\package.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! Error: EPERM, rename 'C:\NPM\Cache\concat-map\0.0.1\package\package.json'
npm ERR!     at Error (native)
npm ERR!  { [Error: EPERM, rename 'C:\NPM\Cache\concat-map\0.0.1\package\package.json']
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   path: 'C:\\NPM\\Cache\\concat-map\\0.0.1\\package\\package.json',
npm ERR!   parent: 'brace-expansion' }
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:\a\1\s\Client\npm-debug.log
Npm failed with error: C:\Program Files\nodejs\npm.cmd failed with return code: 4294963248

Obviously I am not an administrator on this machine. What should I do, assuming that I need phantomjs in my project?

Also, I don't have access to the machine in order to attach C:\a\1\s\Client\npm-debug.log

@ericsciple
Copy link
Contributor

I'll defer to others re: a workaround for the npm issue.

If you need the .log file, you can add an always run task that emits the artifact.upload logging command. See https://github.com/Microsoft/vso-agent-tasks/blob/master/docs/authoring/commands.md for logging command details. Summary at the top of the page gives a short desc how to use.

@benlaan
Copy link
Author

benlaan commented Feb 10, 2016

@ericsciple thanks for that! That's very cool..

File is now attached.. not that I see anything interesting in there..

npm-debug.txt

@ericsciple
Copy link
Contributor

Can you check if this provides a workaround for your issue: #323

See workaround provided in the comment on Dec 5, 2015.

@bryanmacfarlane
Copy link
Contributor

The issue actually wasn't anything to do with PERMS - if you have a package with a deep dependency graph (with duplicates) then the parallel download and writes to the cache were not atomic so it can collide on writes which leads to an EPERM. We got the fix into npm2 recently.

@benlaan
Copy link
Author

benlaan commented Feb 11, 2016

@ericsciple are you saying I should use a custom agent? If so, I have that already. I use it for debugging my build process. But I intended on shutting it down and using hosted for convenience.

What does --force mean? Is this an option for npm install?

@bryanmacfarlane
Copy link
Contributor

--force is an option for npm install which tells it not to use the cache and always get from npm (and thus avoids the bug in the cache).

You don't have to use your own agent if you use --force. But you will need it if you use the other workaround - install npm3 which doesn't have this bug.

Finally, the last workaround is to have a VM with faster I/O (slower adds chance to hit the bug). That can be done by (1) having your own VM with faster I/O (2) wait for use to add premium storage to the hosted pool - it's rolling now across scale units.

Closing this since it's a dupe of #323

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants