emberjs / ember-inflector

ember-inflector goal is to be rails compatible.
MIT License
107 stars 80 forks source link

Ember.ENV.EXTEND_PROTOTYPES - Cannot read property 'String' of undefined #145

Open pavlo opened 6 years ago

pavlo commented 6 years ago

Hey, after a recent update to the app I am receiving the following error: Cannot read property 'String' of undefined. I traced it down to a condition in the inflector's addon/lib/ext/string.js:

if (Ember.ENV.EXTEND_PROTOTYPES === true || Ember.ENV.EXTEND_PROTOTYPES.String) {
    ...
}

My environment does not have EXTEND_PROTOTYPES in it. It has the following, literally:

EmberENV: {
    FEATURES: {
        // Here you can enable experimental features on an ember canary build
        // e.g. 'with-controller': true
    }
 }

What's the most odd here is that all the dependency versions are specific in bower.json, there're no ~ nor ^:

{
    "name": "frontend",
    "dependencies": {
        "ember": "2.6.0",
        "ember-cli-shims": "0.1.1",
        "ember-cli-test-loader": "0.2.2",
        "ember-qunit-notifications": "0.1.0",
        "bootstrap": "3.3.5",
        "pretender": "1.1.0",
        "Faker": "3.1.0",
        "jsoneditor": "5.5.6",
        "jquery-jsonview": "1.2.3",
        "pace": "1.0.2"
     }
}

as well as in package.json:

"devDependencies": {
    "broccoli-asset-rev": "2.4.2",
    "ember-ajax": "2.0.1",
    "ember-bootstrap": "0.7.3",
    "ember-cli": "2.6.2",
    "ember-cli-app-version": "1.0.0",
    "ember-cli-babel": "5.1.6",
    "ember-cli-dependency-checker": "1.2.0",
    "ember-cli-events-bus": "0.0.2",
    "ember-cli-htmlbars": "1.0.3",
    "ember-cli-htmlbars-inline-precompile": "0.3.1",
    "ember-cli-inject-live-reload": "1.4.0",
    "ember-cli-jshint": "1.0.0",
    "ember-cli-moment-shim": "2.0.0",
    "ember-cli-notifications": "3.3.1",
    "ember-cli-pace": "0.1.0",
    "ember-cli-pagination": "2.2.2",
    "ember-cli-qunit": "1.4.0",
    "ember-cli-release": "0.2.9",
    "ember-cli-sri": "2.1.0",
    "ember-cli-sticky": "0.6.1",
    "ember-cli-uglify": "1.2.0",
    "ember-data": "2.14.2",
    "ember-export-application-global": "1.0.5",
    "ember-json-editor-for": "1.1.3",
    "ember-load-initializers": "0.5.1",
    "ember-moment": "7.0.0-beta.3",
    "ember-resolver": "2.0.3",
    "ember-welcome-page": "1.0.1",
    "loader.js": "4.0.1",
    "ember-cp-validations": "3.3.2"
}

so I did not expect that a regular update would break the app! :(

Could you please help me out sorting the particular issue as well as share a link to a resource to help figuring out how to "freeze" the dependencies reliable so it is not that fragile all of the sudden?

Thank you!

GaltMidas commented 6 years ago

Anybody find a workaround for this?

pavlo commented 6 years ago

@GaltMidas, I had to set 2.2.0 version in package.json explicitly since the bug(?) was introduced in 2.3.0 I guess. So the following helped:

"ember-inflector": "2.2.0"

Let me know if this helps you out.

GarPit commented 6 years ago

The same issue for me

sandstrom commented 4 years ago

@pavlo Can you try with 4.0.0 (https://github.com/emberjs/ember-inflector/blob/master/CHANGELOG.md). I'm pretty sure this is no longer an issue.

Or just feel free to close this issue. We can re-open if needed.