-->

Errors using Yeoman

2019-08-16 08:31发布

问题:

I am trying to set up an AngularJS site using Yeoman:

$ yo angular

The installation is partly successful. The directory is being populated with all those files, but there are also several errors that left me wondering if the init was complete:

npm ERR! Error: EACCES, symlink '../grunt-autoprefixer/node_modules/autoprefixer/bin/autoprefixer'
npm ERR!  { [Error: EACCES, symlink '../grunt-autoprefixer/node_modules/autoprefixer/bin/autoprefixer']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '../grunt-autoprefixer/node_modules/autoprefixer/bin/autoprefixer' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.2.0-56-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /home/username/Development/LearnAngularJS
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! path ../grunt-autoprefixer/node_modules/autoprefixer/bin/autoprefixer
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, symlink '../grunt-autoprefixer/node_modules/autoprefixer/bin/autoprefixer'

npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/username/Development/LearnAngularJS/npm-debug.log
npm ERR! not ok code 0
npm ERR! Error: EACCES, symlink '../karma/bin/karma'
npm ERR!  { [Error: EACCES, symlink '../karma/bin/karma'] errno: 3, code: 'EACCES', path: '../karma/bin/karma' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.2.0-56-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "grunt-karma" "karma-ng-html2js-preprocessor" "karma-ng-scenario" "--save-dev"
npm ERR! cwd /home/username/Development/LearnAngularJS
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! path ../karma/bin/karma
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, symlink '../karma/bin/karma'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/username/Development/LearnAngularJS/npm-debug.log
npm ERR! not ok code 0

I am not sure why I'd need to run the init as root, that doesn't seem right. Where exactly is it looking (and failing) for those paths "../grunt-autoprefixer/node_modules", "../karma/bin/karma"? And, of course, what should I do to fix this behaviour?

回答1:

Is this inside a VirtualBox or Vagrant shared folder? I got the same error and found it was because VirtualBox 4.18+ does not support symlinks inside shared folders: https://www.virtualbox.org/ticket/10085