我在使用Yeoman将Karma添加到Angular JS生成的Web应用程序时面临挑战。
当我运行yo karma
时,它会显示以下错误:
pdc1-4s6zyr1:ShippingSolutionPlain administrator$ dsenableroot
username = administrator
user password:
root password:
verify root password:
dsenableroot:: ***Successfully enabled root user.
pdc1-4s6zyr1:ShippingSolutionPlain administrator$ sudo yo karma --allow-root
identical test/karma.conf.js
npm WARN package.json shippingsolutionplain@ No repository field.
npm ERR! Error: EACCES, mkdir '/Users/administrator/.npm/karma-jasmine/0.3.5'
npm ERR! { [Error: EACCES, mkdir '/Users/administrator/.npm/karma-jasmine/0.3.5']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/administrator/.npm/karma-jasmine/0.3.5',
npm ERR! parent: 'shippingsolutionplain' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "karma-phantomjs-launcher" "karma-jasmine" "grunt-karma" "--save-dev"
npm ERR! cwd /Users/administrator/Desktop/CiscoShipping/ShippingSolutionPlain
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR! path /Users/administrator/.npm/karma-jasmine/0.3.5
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/Users/administrator/.npm/karma-jasmine/0.3.5'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/administrator/Desktop/CiscoShipping/ShippingSolutionPlain/npm-debug.log
npm ERR! not ok code 0
pdc1-4s6zyr1:ShippingSolutionPlain administrator$
此外,在本地安装模块并运行它不起作用。
pdc1-4s6zyr1:ShippingSolutionPlain administrator$ sudo yo karma --allow-root
create test/karma.conf.js
npm WARN package.json shippingsolutionplain@ No repository field.
npm ERR! Error: EACCES, unlink '/Users/administrator/Desktop/CiscoShipping/ShippingSolutionPlain/node_modules/karma-phantomjs-launcher/node_modules/.bin/phantomjs'
npm ERR! { [Error: EACCES, unlink '/Users/administrator/Desktop/CiscoShipping/ShippingSolutionPlain/node_modules/karma-phantomjs-launcher/node_modules/.bin/phantomjs']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/administrator/Desktop/CiscoShipping/ShippingSolutionPlain/node_modules/karma-phantomjs-launcher/node_modules/.bin/phantomjs' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "karma-phantomjs-launcher" "karma-jasmine" "grunt-karma" "--save-dev"
npm ERR! cwd /Users/administrator/Desktop/CiscoShipping/ShippingSolutionPlain
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR! path /Users/administrator/Desktop/CiscoShipping/ShippingSolutionPlain/node_modules/karma-phantomjs-launcher/node_modules/.bin/phantomjs
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/Users/administrator/Desktop/CiscoShipping/ShippingSolutionPlain/node_modules/karma-phantomjs-launcher/node_modules/.bin/phantomjs'
npm ERR! error rolling back Error: EACCES, unlink '/Users/administrator/Desktop/CiscoShipping/ShippingSolutionPlain/node_modules/karma-phantomjs-launcher/node_modules/.bin/phantomjs'
npm ERR! error rolling back { [Error: EACCES, unlink '/Users/administrator/Desktop/CiscoShipping/ShippingSolutionPlain/node_modules/karma-phantomjs-launcher/node_modules/.bin/phantomjs']
npm ERR! error rolling back errno: 3,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/Users/administrator/Desktop/CiscoShipping/ShippingSolutionPlain/node_modules/karma-phantomjs-launcher/node_modules/.bin/phantomjs' }
npm ERR! not ok code 0
pdc1-4s6zyr1:ShippingSolutionPlain administrator$
有没有人遇到过这样的问题?
ANKIT