Path or pattern did not match any files [string exception]

I’m getting this error when trying to use addon which includes asset files. Here are steps to reproduce:

$ ember addon example-addon

$ cd example-addon

$ mkdir vendor/example-addon

$ echo ‘body { background-color: #add8e6 }’ > vendor/example-addon/style.css

$ vi index.js

var path = require('path');

module.exports = {

  name: 'example-addon',

  included: function(app) {
    this._super.included(app);
    var modulePath = path.relative(app.project.root, __dirname);
    app.import(path.join(modulePath, 'vendor/example-addon/style.css'));
  }
};

$ ember serve // WORKS FINE

$ cd …/my-app

$ npm install --save-dev …/example-addon

$ ember serve

version: 0.1.1
Livereload server on port 35729
Serving on http://0.0.0.0:4200
Path or pattern "node_modules/example-addon/vendor/example-addon/style.css" did not match any files [string exception]
Error: Path or pattern "node_modules/example-addon/vendor/example-addon/style.css" did not match any files [string exception]
    at /home/woodzu/Ember/tmp/my-app/node_modules/ember-cli/node_modules/broccoli/lib/builder.js:34:15
    at $$$internal$$tryCatch (/home/woodzu/Ember/tmp/my-app/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:470:16)
    at $$$internal$$invokeCallback (/home/woodzu/Ember/tmp/my-app/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:482:17)
    at $$$internal$$publish (/home/woodzu/Ember/tmp/my-app/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:453:11)
    at $$$internal$$publishRejection (/home/woodzu/Ember/tmp/my-app/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:395:7)
    at $$rsvp$asap$$flush (/home/woodzu/Ember/tmp/my-app/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1531:9)
    at process._tickCallback (node.js:419:13)

$ ls -la node_modules/example-addon/vendor/example-addon/style.css

-rw-rw-r-- 1 woodzu woodzu 35 Oct  6 21:10 node_modules/example-addon/vendor/example-addon/style.css

Getting the same issue when in index.js I declare app.import(‘vendor/example-addon/style.css’);

Perhaps the addon is now in bower_components and not in vendor

Hi @broerse. I wish that was the case

@WooDzu did you ever figure this out? I’m having the same problem in 1.13.8

I think I’ve given up on this one as it was not a high priority for my at the time. Now I’d rather look into setting up Brocfile/ember-cli-build.js to copy the css files into ember-cli’s public folder.

Have you manually deleted any files? As in - have you deelted CLI generated files without using the CLI?

If you do this then you will get errors like that. You need to

ember delete resourcetype resourcename

And all of the things will be fine

@Wayne_Douglas No, not at all. I’ve posted a question at SO explaining in detail what i’ve done. At the bottom i posted an update showing the same problem in a new app.

What i didn’t mention there is that i’m also able to run ember serve within the addon project itself. It seems that i’m missing some crucial step in allowing the addon to be imported.

1 Like