Wasswa Samuel
Wasswa Samuel

Reputation: 2179

ember-cli -TypeError : undefined is not a function after running ember server

I created a new ember app using ember-cli like so

ember new myapp
cd myapp
ember server.

I get the following cryptic error.

 ember server
 version: 0.2.0-beta.1
 Livereload server on port 35729
 Serving on http://0.0.0.0:4200/
 undefined is not a function
 TypeError: undefined is not a function
at rimraf (/vagrant/fadis-web/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rimraf/rimraf.js:57:13)
at lib$rsvp$node$$tryApply (/vagrant/fadis-web/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1467:11)
at lib$rsvp$node$$handleValueInput (/vagrant/fadis-web/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1567:20)
at fn (/vagrant/fadis-web/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1555:18)
at /vagrant/fadis-web/node_modules/ember-cli/node_modules/broccoli-caching-writer/index.js:100:14
at lib$rsvp$$internal$$tryCatch (/vagrant/fadis-web/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:489:16)
at lib$rsvp$$internal$$invokeCallback (/vagrant/fadis-web/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:501:17)
at lib$rsvp$$internal$$publish (/vagrant/fadis-web/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:472:11)
at lib$rsvp$asap$$flush (/vagrant/fadis-web/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:1290:9)
at process._tickCallback (node.js:355:11)

I am completely new to ember so I have no idea what is going on. Any suggestions.

Upvotes: 4

Views: 1539

Answers (3)

Wasswa Samuel
Wasswa Samuel

Reputation: 2179

Upgrading to ember-cli 0.2.0 did the trick.

Upvotes: 1

mnowik
mnowik

Reputation: 254

I fixed the problem by installing the package "rimraf":"2.2.8".

It is related to this post: https://github.com/ember-cli/ember-cli/issues/3413

Upvotes: 5

Stefan Ladwig
Stefan Ladwig

Reputation: 589

I solved it.

Things I did:

  • tried to follow https://github.com/ember-cli/ember-cli/issues/3486 suggestions... didn't work, but pointed me in the right direction

  • removed my node_modules folder with rm -R node_modules

  • run npm install
  • got some warnings like:

    npm WARN unmet dependency /Users/sk/projects/ui/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rimraf requires glob@'^4.4.2' but will load 
    npm WARN unmet dependency /Users/sk/projects/ui/node_modules/ember-cli/node_modules/glob,
    npm WARN unmet dependency which is version 4.0.5
    npm WARN unmet dependency /Users/sk/projects/ui/node_modules/ember-cli/node_modules/broccoli-es6modules/node_modules/broccoli-caching-writer/node_modules/rimraf requires glob@'^4.4.2' but will load
    
  • then I explicitly added broccoli-caching-writer to the package.json requesting the last version of the previous major and it worked.

  • run remove node_modules and rerun npm install and it worked

This is what I added to package.json:

"broccoli-caching-writer": "0.4.2",
"broccoli-es6modules": "0.4.3",
"broccoli-sourcemap-concat": "0.4.0"

Edit: Update

It seems to me like the error was cause by an incomplete ember-cli folder structure. I didn't had the app/styles folder (and some others) before, so I added them from a blank ember-cli project, deleted the node_modules folder, removed the lines added above and rerun npm install and it worked. Probably this is related.

Upvotes: 0

Related Questions