Ember build issue: "Cannot use the decorators and decorators-legacy plugin together" - ember.js

I have recently encountered an issue with building my ember project with bitbucket pipelines:
+ ember build --environment="production"
Could not start watchman
Visit https://ember-cli.com/user-guide/#watchman for more info.
Building
Environment: production
cleaning up
cleaning up...
Build Error (broccoli-persistent-filter:Babel > [Babel: ember-data]) in ember-data/adapters/json-api.js
Cannot use the decorators and decorators-legacy plugin together
I am currently using ember-cli version 3.8.1.
The issue occurs with all build environments, not just production.
What baffles me is that no new npm package or ember addon was added between last successful build and the ones that have been failing since - and now if I re-run the successful build, that will also fail.
I have gone back in the commit history to a commit that worked, then fast-forward into the present step-by-step - always deleting the node_modules and reinstalling the packages. It always works locally, but it will always fail when the pipeline is run.
I have also tried updating my docker image.
I have already gone through and tried the solutions listed here - but it seems like they have already been addressed in version 3.8.1.
Also, if it is any help, this is my bitbucket-pipelines.yml:
pipelines:
branches:
master:
- step:
name: Building Ember Project
script:
- npm install
- npm install firebase-tools
- ember build --environment="production"
- step:
trigger: manual
deployment: production
name: Deploy to Production
script:
- firebase use prod
- firebase deploy --non-interactive --token ${FIREBASE_TOKEN}
Thank you all in advance!

This sounds like a sub-dependency changing on the fly under the hood. Do you have an npm or yarn lockfile commited as part of your repo? Lockfiles are specifically designed to keep from hitting snags like this

I have gone through the below errors,
Build error : “Cannot use the decorators and decorators-legacy plugin together”
Build error: 'relationshipStateFor' is not exported by -private\system\record-data-for.js
On browser got Expected store.createRecordDataFor to be implemented but it wasn't.
Reason for the above error is with ember-data addon and mismatch in ember-cli version installed for my project.
In your package.json, You might have defined ember-cli version( "ember-cli": "^3.11.0",) with ^ symbol this means it will install latest version which is less than the 4.0.0. So your ember-cli in node_modules might be installed to the latest version.
The above mentioned error is caused by the ember-cli version which was installed and pointed to 3.15.0. So I have removed the ^ and updated "ember-cli": "3.11.0", and removed node_modules and did npm install that solves the above problem.

Related

Expo 36: Unable to resolve "../../data" from "node_modules/css-tree/lib/syntax/default.js"

Got this error after upgrading expo 35 to 36.
Unable to resolve "../../data" from "node_modules/css-tree/lib/syntax/default.js"
I've tried to yarn add css-tree. This error was gone, but then module react-native-svg started giving the same error with it's included css-tree module.
I've tried to upgrad expo-cli to the latest version and restart terminal. I'm running builds with expo start -c to ensure cache doesn't affect it. I've tried to delete app from the simulator. Still the same.
I've been able to apply a temporary fix by upgrading css-tree dependency inside the react-native-svg, but this is a really wrong way to go as far as I know.
Any ideas?
I found a way to fix it, you just need to install css-tree package on your project.
npm install css-tree
or if you are using yarn
yarn add css-tree
as of SDK 38 this problem still shows up and seems to be caused by a version resolution issue where Yarn/NPM understands 1.0.0-alpha9 to be more recent then 1.0.0-alpha.37 (which is the minimum requirement for react-native-svg-transformer).
Using the resolutions override with Yarn 2 or Yarn 1 as follows fixed it for me with no other extra tweaking.
"resolutions": {
"css-tree": "1.0.0-alpha.39"
}
"resolutions": {
"**/css-tree": "1.0.0-alpha.39"
}
I needed to use react-native-svg-icon ran into the exact same issue.
I'm also running Expo SDK v36, and when it suggested me to install react-native-svg via the cli : expo install react-native-svg, that's what I did; there were errors with this approach most notably when you use import { Circle } from 'react-native-svg' (for newer versions of the package) and 'expo' sometimes doesn't install the package.json properly so I found installing the same version of react-native-svg w/o expo cli was the best approach.
Try running this npm i react-native-svg#9.13.3
Fixed it for me.
This issue occurred for me when building my app using MS App Center, the App Center build scripts picked up on an old yarn.lock file in the project using the line if [ -f yarn.lock ]; then { yarn install && yarn list --depth=0; } else npm install; fi however I normally use npm rather than Yarn.
Removing this file allowed the build to use npm which resolved this issue.

How to create a ember version specific project?

When i use,
ember new projname
project is getting created with 2.7.0 ember version. I want to create a older version ember project. What i should use? [i checked options that can be used with new command, but none helps for this.]
Here's what I ended up doing:
create a new directory for my project and cd inside of it
npm init (enter through some bogus details, doesn't matter, we're going to erase soon)
npm install --save-dev ember-cli#desired.version
delete package.json and package-lock.json
ember new app
This got me a node_modules folder with the desired version of ember, and then also allowed me to use the ember cli to generate a project. It will create a folder with the name of the app, of course, and you can safely delete the node_modules folder in the app's parent directory.
This feels like a little bit of a round-about way of doing things, but it worked, and it seemed easier than trying to mess with my global versions.
Hope this helps someone out!
Ember new will create project at the most current version installed on your system.
There are 2 ways around this.
Install an older version of ember-cli globally for the desired version. The benefit would be that you create a new app at the desired version from the get go:
(change #2.11.0 to the desired version from https://github.com/emberjs/ember.js/releases)
npm uninstall -g ember-cli
npm cache clean
npm install -g ember-cli#2.11.0
Keep the current ember-cli version and then downgrade by changing the ember value in package.json :
(this will work for small version changes, not major changes)
you will need to re init your ember app (change 2.11.0 to what you need from https://github.com/emberjs/ember.js/releases)
rm -rf node_modules dist tmp
npm install --save-dev ember-cli#2.11.0
ember init
Node.js is required with every Ember installation and you have to check which version of node is required for the desired version of Ember you want to install. Most likely itll work well with the version currently installed.
you can download the latest (LTS) from: https://nodejs.org/en/
or older versions from: https://nodejs.org/dist/
OSx for example https://nodejs.org/dist/v4.7.0/node-v4.7.0-linux-x64.tar.gz
results

Uncaught Error: Could not find module `ember-qunit`. Odd out-of-the-box ember-cli behavior

I believe I may have an environment issue here, but I'm quite stuck as to what I can to do resolve it. I created an ember-cli project, committed it to git, added a few things. I ran the typical npm install && bower install commands and tried ember s.
Although the site loads fine, when I browsed to the http://localhost:4200/tests/ to ensure qunit was up and running, I had a few errors.
Uncaught Error: Could not find module `ember-qunit` imported from `ember-project/tests/test-helper
Uncaught Error: Assertion Failed: The tests file was not loaded. Make sure your tests index.html includes "assets/tests.js".
Immediately this raised a red flag, as I have created several ember projects before and not run into similar issues. I had my partners (I'm in school) checkout the project, run the npm install && bower install && ember s and the qunit module worked fine for them!
I've tried to git clone a new repo several times, I've even went so far as to uninstall node and bower completely, but no matter what I try I cannot seem to pull up a normal /tests checkout.
My partners were both running VMs - Ubuntu and Debian, while I'm on a mac, but that seems like it shouldn't be too big of an issue, especially since I created the project!
I've looked several places for this (here, here, and here), but I cannot seem to come to a conclusion which works for me.
I do have an identical bower.json as the rest of my group. I've included the picture below of my file structure, my bower.json, and my tests/index.html.
screenshot
Here are some environment stats:
ember version: 1.13.13
node: 5.0.0
os: darwin x64
bower: 1.7.1
One thing that I did notice is a difference when I do this to see npm's version, but I'm not sure if that matters or not.
ember -v
npm: 2.14.10
npm -v
npm: 3.5.2
It appears to be a regression from the work in ember-cli beta. You can track the progress here https://github.com/ember-cli/ember-cli/issues/5411.
For now, you can add
app.import('bower_components/qunit/qunit/qunit.js');
app.import('bower_components/ember-qunit/ember-qunit.amd.js');
to ember-cli-build.js as a workaround.

Error installing ember-cli-mocha

I'm trying to setup an EmberJS project using ember-cli. I want to be able to use Mocha/Chai instead of the default qunit, but I am getting an error at the first step on installing ember-cli-mocha.
I create the new ember project with ember new my-project and then from within the project folder I run ember install ember-cli-mocha, selecting Yes to overwrite the tests/test-helper.js.
In the output, immediately following the Installed browser packages via Bower. message I see:
Package ember-cli/ember-cli-test-loader=ember-cli/ember-cli-test-loader not found
I can't find any information on this directly. I've tried installing the various packages themselves, before the ember-cli-mocha package via npm and bower, but I always get that message when installing ember-cli-mocha through ember-cli.
Anyone else have experience with this? Thanks in advance!

NPM repo missing file

I have a git repo for an Ember Addon:
https://github.com/lifegadget/ui-responsive-toolbelt
It passes all unit tests. It has been published to npm as ui-responsive-toolbelt. I have used npm's "link" functionality to test locally that this "addon" (in Ember parlance) works fine in consuming application when included in the package.json file as a dependency.
Surprisingly, and I'm completely flummoxed on this, when npm installs this dependency into an Ember project directory it brings across a vast majority of the files without complaining. From NPM's perspective it appears to be a clean install. Unfortunately an addon depends heavily on it's "entry point" which is the index.js in the root directory of the repo. I have very clearly included this file in the repo but for some reason it is not being brough over!
I have tried this on two computers and three Ember projects and all have the same outcome. Please help!
the error message I get from Ember-CLI when I try to start the server with ember serve is:
The package ui-responsive-toolbelt is not a properly formatted package, we have used a fallback lookup to resolve it at /path/to/project/node_modules/ui-responsive-toolbelt. This is generally caused by an addon not having a main entry point (or index.js).
This message is repeated twice and then I get:
The ui-responsive-toolbelt addon could not be found at /path/to/project/node_modules/ui-list/node_modules/ui-responsive-toolbelt.
I confirmed that your repo looks fine
npm install ui-responsive-toolbelt does not download the index file
So the problem is that npm publish is not working properly. There is a bug filled for that. https://github.com/npm/npm/issues/5082
What you can do is publish again your addon using a recent npm version (or play with older versions) until you see that the index file is added too.