Ember serve doesn't work (Error: Couldn't find preset "es2015") - ember.js

I am building a web app using Ember. I created the project with ember new test-app and have made no changes to the generated files. When I run ember serve, I immediately receive the following error:
The Broccoli Plugin: [BroccoliMergeTrees: Addon#compileAddon(ember-welcome-page) ] failed with:
Error: Couldn't find preset "es2015" relative to directory "/Users/jacob"
at /Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
at Array.map ()
at OptionManager.resolvePresets (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
at OptionManager.mergePresets (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
at OptionManager.mergeOptions (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
at OptionManager.init (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
at File.initOptions (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/index.js:212:65)
at new File (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/file/index.js:135:24)
at Pipeline.transform (/Users/jacob/Desktop/test-app/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at Promise (/Users/jacob/Desktop/test-app/node_modules/broccoli-babel-transpiler/lib/parallel-api.js:102:26)
The broccoli plugin was instantiated at:
at BroccoliMergeTrees.Plugin (/Users/jacob/Desktop/test-app/node_modules/broccoli-plugin/index.js:7:31)
at new BroccoliMergeTrees (/Users/jacob/Desktop/test-app/node_modules/ember-cli/node_modules/broccoli-merge-trees/index.js:16:10)
at Function.BroccoliMergeTrees [as _upstreamMergeTrees] (/Users/jacob/Desktop/test-app/node_modules/ember-cli/node_modules/broccoli-merge-trees/index.js:10:53)
at mergeTrees (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/broccoli/merge-trees.js:85:33)
at Class.compileAddon (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/models/addon.js:1092:12)
at Class.treeForAddon (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/models/addon.js:746:26)
at Class.treeForAddon (/Users/jacob/Desktop/test-app/node_modules/ember-welcome-page/index.js:27:41)
at Class.superWrapper [as treeForAddon] (/Users/jacob/Desktop/test-app/node_modules/core-object/lib/assign-properties.js:34:20)
at Class._treeFor (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/models/addon.js:557:33)
at Class.treeFor (/Users/jacob/Desktop/test-app/node_modules/ember-cli/lib/models/addon.js:517:21)
I referred to this question for help, but I still received the same error after trying the solution.
I am running ember-cli v2.16.2 and node v8.9.0 on macOS High Sierra. In my node installation, the only three global modules I have installed are bower, broccoli-cli, and ember-cli.

Please do clean reinstall of ember-cli package.
npm uninstall -g ember-cli
npm cache clean --force
npm install -g ember-cli
Then run your ember new command once again and test it.

Related

Cannot find module './transforms/babel-plugin-convert-existence-checks-to-macros'

I've recently updated ember-cli and my app to 4.10.0, and trying to build with:
ember serve
throws the following error:
Cannot find module './transforms/babel-plugin-convert-existence-checks-to-macros'
I've looked to see what module is missing. I came up with trying to install/reinstall ember-cli-babel and that didn't work either.
The ember app is on LAMP: Raspbian Linux 11 OS, Apache 2.4.54, MariaDB 10.5.15, and PHP/Laravel 8 backend
ember-cli: 4.10.0
ember-source: 4.10.0
ember-cli-babel: 7.26.11
I don't have any special ember-cli-build configurations, here it is:
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
const app = new EmberApp(defaults, {
});
return app.toTree();
}
EDIT: ERROR STACK
- name: Error
- nodeAnnotation: [undefined]
- nodeName: [undefined]
- originalErrorMessage: [undefined]
- stack: Error: Cannot find module './transforms/babel-plugin-convert-existence-checks-to-macros'
Require stack:
- /var/www/html/.../node_modules/#ember-data/private-build-infra/src/debug-macros.js
- /var/www/html/.../node_modules/#ember-data/private-build-infra/src/stripped-build-plugins.js
- /var/www/html/.../node_modules/#ember-data/private-build-infra/src/addon-build-config-for-data-package.js
- /var/www/html/.../node_modules/ember-data/index.js
- /var/www/html/.../node_modules/ember-cli/lib/models/package-info-cache/package-info.js
- /var/www/html/.../node_modules/ember-cli/lib/models/package-info-cache/index.js
- /var/www/html/.../node_modules/ember-cli/lib/models/project.js
- /var/www/html/.../node_modules/ember-cli/lib/utilities/get-config.js
- /var/www/html/.../node_modules/ember-cli/lib/utilities/instrumentation.js
- /var/www/html/.../node_modules/ember-cli/lib/cli/index.js
- /usr/local/lib/node_modules/ember-cli/bin/ember
at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
at Function.resolve (node:internal/modules/cjs/helpers:109:19)
at debugMacros (/var/www/html/.../node_modules/#ember-data/private-build-infra/src/debug-macros.js:6:44)
at module.exports (/var/www/html/.../node_modules/#ember-data/private-build-infra/src/stripped-build-plugins.js:11:48)
at Class.buildBabelOptions (/var/www/html/.../node_modules/#ember-data/private-build-infra/src/addon-build-config-for-data-package.js:149:62)
at Class._setupBabelOptions (/var/www/html/.../node_modules/#ember-data/private-build-infra/src/addon-build-config-for-data-package.js:168:33)
at Class.included (/var/www/html/.../node_modules/#ember-data/private-build-infra/src/addon-build-config-for-data-package.js:184:12)
at Class.superWrapper [as included] (/var/www/html/.../node_modules/core-object/lib/assign-properties.js:34:20)
at /var/www/html/.../node_modules/ember-cli/lib/models/addon.js:497:26
at Array.reduce (<anonymous>)
at Class.eachAddonInvoke (/var/www/html/.../node_modules/ember-cli/lib/models/addon.js:494:24)
at Class.included (/var/www/html/.../node_modules/ember-cli/lib/models/addon.js:769:10)
at Class.superWrapper [as included] (/var/www/html/.../node_modules/core-object/lib/assign-properties.js:34:20)
at Class.included (/var/www/html/.../node_modules/#ember-data/private-build-infra/src/addon-build-config-for-data-package.js:174:28)
at Class.superWrapper [as included] (/var/www/html/.../node_modules/core-object/lib/assign-properties.js:34:20)
at /var/www/html/.../node_modules/ember-cli/lib/broccoli/ember-app.js:721:15
After days of googling and trying a variety of things, I was able to get my ember application to launch again. Here is what worked for me, for whatever reason.
I removed all the files inside my projects node_modules directory
sudo rm -r node_modules/*
and reinstalled all those packages with
npm install
After this, and I'm not sure if this really had anything to do with the resolution, I updated npm from 9.4.1 to 9.4.2
npm install -g npm#9.4.2
Once all of those commands executed successfully, I ran
ember serve
and I no longer received the above error.
I hadn't thought I ever used sudo to install any npm packages, at least I try to make it a habit not to. But, it's possible I screwed up during my many butchered attempts at updating my ember app from 4.9 to 4.10.

Ember build failing

I can't build my ember app, I get this error message. Tried
rm -rf node_modules bower_components dist tmp
And installed npm and bower again but it didn't work
The Broccoli Plugin: [SourceMapConcat: Concat: Vendor /assets/vendor.js] failed with:
Error: ENOENT: no such file or directory, stat '/home/ubuntu/workspace/qr-prototype/configtool-ember/tmp/source_map_concat-input_base_path-DgleBN9U.tmp/0/bower_components/keyboard/dist/js/jquery.keyboard.js'
at Error (native)
at Object.fs.statSync (fs.js:844:18)
at ConcatWithMaps.keyForFile (/home/ubuntu/workspace/qr-prototype/configtool-ember/node_modules/ember-cli/node_modules/broccoli-concat/node_modules/broccoli-caching-writer/index.js:90:20)
at Array.map (native)
at ConcatWithMaps.CachingWriter._conditionalBuild (/home/ubuntu/workspace/qr-prototype/configtool-ember/node_modules/ember-cli/node_modules/broccoli-concat/node_modules/broccoli-caching-writer/index.js:112:65)
at /home/ubuntu/workspace/qr-prototype/configtool-ember/node_modules/ember-cli/node_modules/broccoli-concat/node_modules/broccoli-caching-writer/node_modules/broccoli-plugin/read_compat.js:61:34
at lib$rsvp$$internal$$tryCatch (/home/ubuntu/workspace/qr-prototype/configtool-ember/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1036:16)
at lib$rsvp$$internal$$invokeCallback (/home/ubuntu/workspace/qr-prototype/configtool-ember/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1048:17)
at lib$rsvp$$internal$$publish (/home/ubuntu/workspace/qr-prototype/configtool-ember/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1019:11)
at lib$rsvp$asap$$flush (/home/ubuntu/workspace/qr-prototype/configtool-ember/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
The broccoli plugin was instantiated at:
at ConcatWithMaps.Plugin (/home/ubuntu/workspace/qr-prototype/configtool-ember/node_modules/ember-cli/node_modules/broccoli-concat/node_modules/broccoli-caching-writer/node_modules/broccoli-plugin/index.js:10:31)
at ConcatWithMaps.CachingWriter [as constructor] (/home/ubuntu/workspace/qr-prototype/configtool-ember/node_modules/ember-cli/node_modules/broccoli-concat/node_modules/broccoli-caching-writer/index.js:21:10)
at new ConcatWithMaps (/home/ubuntu/workspace/qr-prototype/configtool-ember/node_modules/ember-cli/node_modules/broccoli-concat/concat.js:22:17)
at module.exports (/home/ubuntu/workspace/qr-prototype/configtool-ember/node_modules/ember-cli/node_modules/broccoli-concat/index.js:26:10)
at EmberApp.concatFiles (/home/ubuntu/workspace/qr-prototype/configtool-ember/node_modules/ember-cli/lib/broccoli/ember-app.js:329:10)
at EmberApp.javascript (/home/ubuntu/workspace/qr-prototype/configtool-ember/node_modules/ember-cli/lib/broccoli/ember-app.js:1190:12)
at EmberApp.toArray (/home/ubuntu/workspace/qr-prototype/configtool-ember/node_modules/ember-cli/lib/broccoli/ember-app.js:1542:10)
at EmberApp.toTree (/home/ubuntu/workspace/qr-prototype/configtool-ember/node_modules/ember-cli/lib/broccoli/ember-app.js:1564:30)
at module.exports (/home/ubuntu/workspace/qr-prototype/configtool-ember/ember-cli-build.js:35:14)
at Class.module.exports.Task.extend.setupBroccoliBuilder (/home/ubuntu/workspace/qr-prototype/configtool-ember/node_modules/ember-cli/lib/models/builder.js:55:19)
Solved It, I was importing some bower components on my ember-cli-build.js that weren't properly installed. I manually installed with bower install keyboard and it worked.
app.import('bower_components/keyboard/dist/js/jquery.keyboard.js');
app.import('bower_components/keyboard/dist/css/keyboard.min.css');
app.import('bower_components/keyboard/dist/css/keyboard-previewkeyset.min.css');
app.import('bower_components/keyboard/dist/js/jquery.keyboard.extension-all.min.js');

ember-cli cleanup error when building

I had ember-cli installed on my computer and my app was running perfectly, but yesterday I formatted my computer and upgraded to windows 10 and tried to install ember-cli exactly the same way it was before but now when I try to build or run my application I get this error:
Future versions of Ember CLI will not support v4.2.1. Please update to Node 0.12 or io.js.
version: 1.13.8
Cleanup error.
ENOTEMPTY: directory not empty, rmdir 'C:\Software\company\product\client-side\product2\tmp\concat_with_maps-output_path-jfPUvJvW.tmp'
Error: ENOTEMPTY: directory not empty, rmdir 'C:\Software\company\product\client-side\product2\tmp\concat_with_maps-output_path-jfPUvJvW.tmp'
at Error (native)
at Object.fs.rmdirSync (fs.js:763:18)
at rmkidsSync (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\node_modules\broccoli-plugin\node_modules\quick-temp\node_modules\rimraf\rimraf.js:247:11)
at rmdirSync (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\node_modules\broccoli-plugin\node_modules\quick-temp\node_modules\rimraf\rimraf.js:237:7)
at fixWinEPERMSync (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\node_modules\broccoli-plugin\node_modules\quick-temp\node_modules\rimraf\rimraf.js:150:5)
at Function.rimrafSync [as sync] (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\node_modules\broccoli-plugin\node_modules\quick-temp\node_modules\rimraf\rimraf.js:216:26)
at Object.remove (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\node_modules\broccoli-plugin\node_modules\quick-temp\index.js:26:12)
at ReadCompat.cleanup (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\node_modules\broccoli-plugin\read_compat.js:69:13)
at ConcatWithMaps.Plugin.cleanup (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\node_modules\broccoli-plugin\index.js:113:49)
at cleanupTree (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli\lib\builder.js:147:17)
Build failed.
ENOENT: no such file or directory, open 'C:\Software\company\product\client-side\product2\tmp\concat_with_maps-input_base_path-QzODcQgu.tmp\0\C:\Software\company\product\client-side\product2\tmp\concat_with_maps-input_base_path-QzODcQgu.tmp\0\ember-basic-dropdown\components\basic-dropdown.js'
Error: ENOENT: no such file or directory, open 'C:\Software\company\product\client-side\product2\tmp\concat_with_maps-input_base_path-QzODcQgu.tmp\0\C:\Software\company\product\client-side\product2\tmp\concat_with_maps-input_base_path-QzODcQgu.tmp\0\ember-basic-dropdown\components\basic-dropdown.js'
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at SourceMap.addFile (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\fast-sourcemap-concat\lib\source-map.js:68:19)
at ConcatWithMaps.<anonymous> (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\concat-with-maps.js:96:17)
at Array.forEach (native)
at ConcatWithMaps.addFiles (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\concat-with-maps.js:93:9)
at ConcatWithMaps.build (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\concat-with-maps.js:65:8)
at C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\index.js:152:21
at lib$rsvp$$internal$$tryCatch (C:\Software\company\product\client-side\product2\node_modules\ember-cli\node_modules\rsvp\dist\rsvp.js:493:16)
node v4.2.1
npm v2.14.7
But I've tried with others versions and the problem persisted.
The same application is working perfectly on another computer which also has windows 10 and the same node and npm versions.
If you need any extra information leave a comment and I'll edit the question.
I had the same problem today. It seems there's a bug in a dependency module:
"name": "fast-sourcemap-concat",
"version": "0.2.6"
it does not handle properly Windows paths starting with drive letters, like C:/.
For now, I fixed it manually in fast-sourcemap-concat/lib/source-map.js, function _resolveFile, line 55, changing:
if (this.baseDir && filename.slice(0,1) !== '/') {
to:
if (this.baseDir && filename.slice(0,1) !== '/' && filename.slice(1,3) !== ':/') {
Seems to fix the issue for me. Good luck!
This was fixed in https://github.com/ember-cli/ember-cli/issues/5055
You will need to reinstall your node modules:
rm -rf node_modules
npm cache clear
npm install
Try to reinstall Ember CLI in your project directory (local version). You can follow the steps from Ember CLI GitHub releases page - start with rm -rf node_modules bower_components dist tmp and continue following Project Update guide.

Ember error: path "vendor/loader.js/loader.js" did not match any files

Building off: Ember-cli - Bower not installing properly
I just upgraded from ember-cli 0.0.40 to 0.1.2 and when I run the ember server I also have an issue with moment. 48 JSHint Errors of Bad option: 'moment'.
After JSHint is done letting me have it, I did a bad path error for loader.js:
Path or pattern "vendor/loader.js/loader.js" did not match any files
Error: Path or pattern "vendor/loader.js/loader.js" did not match any files
at Object.multiGlob (/home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/broccoli-concat/node_modules/broccoli-kitchen-sink-helpers/index.js:221:13)
at /home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/broccoli-concat/index.js:62:32
at $$$internal$$tryCatch (/home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:470:16)
at $$$internal$$invokeCallback (/home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:482:17)
at $$$internal$$publish (/home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:453:11)
at $$rsvp$asap$$flush (/home/mikeumus/Downloads/RentalGeek/Development/portola-workon29oct/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1531:9)
at process._tickCallback (node.js:419:13)
Before upgrading to ember-cli#0.1.2 I was getting an includes error for ember-cli-simple-auth. I did do ember g ember-cli-simple-auth and that's nifty, but the above error persists.
Make sure to follow the steps on the releases page to have a solid upgrade.
Specifically in your case, this is likely caused by an app.import in your Brocfile.js. One of the big changes was that bower components were moved to /bower_components instead of /vendor. That error says that something is trying to import loader.js from the vendor directory.
It could be caused by you trying to import it in your Brocfile or due to ember-cli not being updated properly in your node_modules folder. If it still references the old version, it will try to import from vendor/ instead of bower_components. To fix that, just rm -rf node_modules and npm install to reinstall the modules.
The releases page mentions how to clear your npm cache to reinstall everything if you are still having trouble.

Brunch, JSDom : Object [ jsdom NodeList ]: contains 3 items has no method 'map'

i'm trying to get headless testing working with Ember, Brunch, and JSDom. I'm using ember-brunch-skeleton to generate the app.
https://github.com/fuseelements/ember-brunch-skeleton
i have all the dependencies installed.
when I try to run 'brunch test' I get the error below. It seems like I'm missing something fundamental here, but this is my first time using node.js/jsdom/mocha etc. What am I missing?
TypeError: Object [ jsdom NodeList ]: contains 3 items has no method 'map'
at getScriptFilesPath (/usr/local/lib/node_modules/brunch/lib/commands/test.js:62:60)
at readTestFiles (/usr/local/lib/node_modules/brunch/lib/commands/test.js:80:25)
at fs.readFile (fs.js:176:14)
at fs.close (/usr/local/lib/node_modules/brunch/node_modules/rimraf/node_modules/graceful-fs/graceful-fs.js:90:5)
at Object.oncomplete (fs.js:297:15)
It looks like this broke with the 0.4.0 version of jsdom. Specifically from the changelog:
Change: NodeLists no longer inconsistently have array methods. Previously, live node lists would have indexOf, while static node lists would have them all. Now, they have no array methods at all, as is correct per the specification.
If you're looking for a quick fix, reverting to jsdom 0.3.4 should do the trick:
npm uninstall jsdom
npm install jsdom#0.3.4
brunch test
I could solve this by uninstalling brunch and installing it again.
It seemed npm was using a old installed version.
Just try:
npm uninstall brunch -g
npm install brunch -g
npm test
brunch --version # should be 1.5.3