Running “ember server” fails with error

人盡茶涼 提交于 2019-12-13 00:55:28

问题


I'm trying to get an existing ember app running locally for development, but when I run "ember server" from inside the app directory, I get this error:

version: 0.0.39
Livereload server on port 35729
Serving on http://0.0.0.0:4200
EACCES, unlink 'dist/assets/.gitkeep'
Error: EACCES, unlink 'dist/assets/.gitkeep'

Per this thread https://github.com/stefanpenner/ember-cli/issues/381 I tried doing the following:

npm uninstall -g ember-cli 
rm -rf node_modules
npm cache clear
npm install -g ember-cli
npm install
bower install

Note however I had to use sudo in front of all the npm commands as well as rm -rf node_modules. I also tried per this thread https://github.com/bower/bower/issues/475 and again using sudo:

npm cache clean
npm uninstall -g bower
npm install -g bower

but none of this worked, I still get the same error. I'm new to using all this Ember tooling i.e. npm, bower, ember-cli, etc. and have a feeling I did something wrong during the install process if I'm having to use sudo all the time. Suggestions for how to fix that error?


回答1:


Ok, I had the same issue and the way to fix is is the following. In your command line (assuming a unix-like system):

Add owner permission to npm: sudo chown -R $(whoami) ~/.npm

Now, if bower is also causing you issues, the way to solve this is to clear the bower cache (as suggested by @torazaburo):

bower cache clear

Or you can do it manually:

cd ~/.cache/bower # navigate to the bower cache directory
rm -rf packages   # delete packages directory and its content
rm -rf registry   # delete registry directory and its content

Hope this helps ...




回答2:


try to remove all node_modules (global) not only from project directory. if you use some version manager like nvm they must be in .nvm dir.




回答3:


The thing that worked for me was running ember server with sudo

sudo ember server




回答4:


This is just a guess: Did you install npm through homebrew? I heard that this can cause problems and forces you to use sudo a lot (https://gist.github.com/DanHerbert/9520689). Should this be the cause of your problem, an alternative for installing npm could be to brew install nvm and then install a node version via nvm. Finally install npm via that node version to keep it outside of homebrew. You might have to uninstall your node modules from homebrew before, of course. See https://stackoverflow.com/a/28025834 for details.



来源:https://stackoverflow.com/questions/25775053/running-ember-server-fails-with-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!