Stuck using ember-cli

I’ve been having problems after problems using ember-cli. At first I could install it and create new ember projects with it.

I can’t think what I have done since then, but now I’m getting this when calling ember new app

Error: Cannot find module '../function/makeIterator_'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/ember-cli/node_modules/bower/node_modules/mout/array/collect.js:2:20)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)

So I uninstall and install ember-cli

sudo npm uninstall ember-cli -g
sudo npm install ember-cli -g

I get lots of warnings like this during installation

npm WARN engine makeerror@1.0.10: wanted: {"node":"0.6.x"} (current: {"node":"0.12.0","npm":"2.5.1"})
npm WARN engine tmpl@1.0.3: wanted: {"node":"0.6.x"} (current: {"node":"0.12.0","npm":"2.5.1"})
/usr/local/bin/ember -> /usr/local/lib/node_modules/ember-cli/bin/ember
npm WARN unmet dependency /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/file-utils requires lodash@'~2.1.0' but will load

Now I’m getting this error when calling ember new test-ember

Installing packages for tooling via npm.../usr/local/lib/node_modules/ember-cli/node_modules/npm/lib/utils/locker.js:66
    throw new Error(
          ^
Error: Attempt to unlock /path/to/test-ember/node_modules/ember-cli-babel, which hasn't been locked
    at unlock (/usr/local/lib/node_modules/ember-cli/node_modules/npm/lib/utils/locker.js:66:11)
    at cb (/usr/local/lib/node_modules/ember-cli/node_modules/npm/lib/install.js:929:5)
    at /usr/local/lib/node_modules/ember-cli/node_modules/npm/lib/install.js:933:20
    at /usr/local/lib/node_modules/ember-cli/node_modules/npm/lib/utils/locker.js:40:9
    at cb (/usr/local/lib/node_modules/ember-cli/node_modules/npm/node_modules/lockfile/lockfile.js:149:38)
    at /usr/local/lib/node_modules/ember-cli/node_modules/npm/node_modules/lockfile/lockfile.js:177:38
    at OpenReq.Req.done (/usr/local/lib/node_modules/ember-cli/node_modules/bower-config/node_modules/graceful-fs/graceful-fs.js:143:5)
    at OpenReq.done (/usr/local/lib/node_modules/ember-cli/node_modules/bower-config/node_modules/graceful-fs/graceful-fs.js:63:22)
    at FSReqWrap.oncomplete (fs.js:99:15)

This seems to be node or npm problem, or maybe ember-cli. Does anyone have any suggestion how I should go about fixing this? maybe trying to clean install node and npm?

Trying doing npm uninstall -g ember-cli, followed by npm cache clean. Then try reinstalling. Also, you’ll want to try removing your node_modules directory and reinstalling local deps, if you’re testing for success within an existing project.

1 Like

I did that and still get the same error message. I think I’m going to try completely removing npm and node.

If you are on a mac, you can avoid the sudo requirement by installing node.js with homebrew instead of the node.js installer.

1 Like

I think @michael_deitcher brings up a good point @reynardh. Did you brew your node install?

no, I actually installed it manually before and then just upgraded it using the mac installer from nodejs. That’s why there are warnings that some node packages expect node 0.6, and might be what’s causing this problem. I’ll try to use homebrew after I do a clean uninstall of node and npm. Thanks for the help!

ok after manually removing all node installation, I used brew install node, and now calling ember new app is working again. Thanks for the help.

I think what caused the problem was that I had used brew to install node before and then I ran the latest installer from node website to upgrade node.

As an aside, it’s always great to review steps outlined by Robert Jackson when Ember-CLI updates are made public.

For each tagged release, he added steps to follow to get your node and bower states cleaned up and the new project files ready to go.

For example, see his ‘Project Update’ steps in https://github.com/ember-cli/ember-cli/releases/tag/v0.1.15

If all else fails and you think you have some node stuff and bower cruft, run the following from command line to blow away everything for node and bower, then reinstall

npm cache clear && bower cache clean && rm -rf node_modules bower_components && npm install && bower install

For having node installed and quickly manage different versions of node (iojs) & npm, I use NVM it’s a pretty impressive tool: https://github.com/creationix/nvm

It can handle different global modules installed, and you can copy packages quickly from one version to another.