Hi all, I’m new to Ember and I’m trying to create new ember app using using ember-cli on ubuntu. For some reason the app is not created and I can’t see any error on screen. Anyone had such problem? Thanks!
have you tried? sudo ember new app
?
Yep, tried to re-install ember-cli and update npm. Nothing helped.
fixed by: sudo apt-get install nodejs instead sudo apt-get install node. Thanks
A warning to all: this will work, but it is generally a very bad idea. The simple truth is that you shouldn’t install node with Synaptic, because it will mean requiring sudo to do basically anything in node. A much better strategy is to use nvm
.
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.24.1/install.sh | bash
- Restart your terminal
nvm install 0.10
nvm use 0.10
- Do all of your node stuff sudo-free (
npm install -g ember-cli
,npm install
,ember s
, etc.)
Note that you’ll need to run nvm use 0.10
every time you restart your terminal. You could also use 0.12 or iojs, but not every add-on supports these right now (SASS being the biggie).
To uninstall node, I’ve found that these instructions work fine on 14.04 even though they say it’s for OSX.
Let me disagree with you in this passage
When you have npm installed by a package manager, the only case you need to use sudo is a global installation of a gem. And in fact it is required only because npm needs to create symlink for the gem in /usr/bin, which is always available to write only for the root user.
It’s totally ok to use nodejs from the package manager, the only point you need to take into account is, as I said above, to install global gems with sudo. All other operations work without sudo, so ember new app-name
is a correct call.
I’d be concerning more about version of the nodejs from the synaptic, because by default it’s 0.10, which is pretty old for ember-cli
nvm alias default 0.10
will set the default version for new terminals.
Apologies, I mispoke. My point stands though- letting any rando who publishes to npm run scripts as a superuser on your machine is a bad idea.
Good call!! Missed that in the docs.
You can change the npm prefix
to something like "/home/$USER/npm"
https://docs.npmjs.com/cli/prefix
This way you’ll never need sudo
for global packages. (Don’t forget to add the prefix bin dir to your PATH
)
Ok. Your solution:
- Change npm
prefix
to/home/$USER/npm
- Add the prefix bin dir to your PATH (what in fact equals to - modify one of your .bash* files)
My solution:
- Write
sudo
before npm when you install a global package.
Can you predict whose solution will be used more often? I believe you can and you know why.
To make it clear - I actually don’t do as I propose and I got your points, especially from Kyle
But (1) bower and ember-cli packages are not from rando, all other packages will be installed without sudo; (2) I don’t even see a problem when I do it in my development environment, for example, in a vagrant box. It’s not an absolute evil, as I understand you, guys, want to imagine it. It’s just a simpler solution in a suitable environment.