0

加载页面会产生以下错误: steal.js:140 Potentially unhandled rejection [1] TypeError: Cannot define property _instanceDefinitions, object is not extensible at Function.defineProperty (<anonymous>) at Object.defineExpando (http://localhost:8080/node_modules/can-define/define-helpers/define-helpers.js:20:11) at DefineMap.setKeyValue (http://localhost:8080/node_modules/can-define/map/map.js:52:30) at Object.setKeyValue (http://localhost:8080/node_modules/can-reflect/reflections/get-set/get-set.js:50:23) at Object.eval (http://localhost:8080/node_modules/can-reflect/reflections/shape/shape.js:701:23) at String.eval (http://localhost:8080/node_modules/can-reflect/reflections/shape/shape.js:445:21) at Object.eachListLike (http://localhost:8080/node_modules/can-reflect/reflections/shape/shape.js:376:17) at Object.eachIndex (http://localhost:8080/node_modules/can-reflect/reflections/shape/shape.js:338:16) at Object.eachKey (http://localhost:8080/node_modules/can-reflect/reflections/shape/shape.js:443:16) at Object.assignDeepMap (http://localhost:8080/node_modules/can-reflect/reflections/shape/shape.js:698:8) Hot realoding 不再起作用。这似乎来自steal.js,我不知道这与我的代码有什么关系。难道这个问题发生在工作线程中......?

这是我的 package.json: ... "dependencies": { "can-ajax": "^1.1.4", "can-component": "^3.3.10", "can-connect": "^1.5.9", "can-define": "^1.5.5", "can-route": "^3.2.3", "can-route-pushstate": "^3.1.2", "can-set": "^1.3.2", "can-stache": "^3.11.1", "can-view-autorender": "^3.1.1", "can-zone": "^0.6.13", "done-autorender": "^1.4.0", "done-component": "^1.0.0", "done-css": "^3.0.1", "done-serve": "^1.5.0", "generator-donejs": "^1.0.7", "lodash": "^4.17.5", "steal": "^1.5.15", "steal-less": "^1.2.0", "steal-stache": "^3.1.2" }, "devDependencies": { "can-fixture": "^1.1.1", "donejs-cli": "^1.0.0", "funcunit": "^3.2.0", "steal-qunit": "^1.0.1", "steal-tools": "^1.9.1", "testee": "^0.3.0" } ... 节点:

node --version v8.9.2 npm --version 5.5.1

操作系统: ver Microsoft Windows [Version 10.0.15063]

4

1 回答 1

1

作为短期解决方案,请尝试添加{ seal: false }到您的应用视图模型:

const AppViewModel = DefineMap.extend({ seal: false }, {
    title: {
        value: 'spotwizard.org',
        serialize: false
    }
});

更新:经过进一步测试,您尝试在您的应用程序视图模型上设置“页面”属性,但您没有定义一个。您的应用程序视图模型应如下所示:

const AppViewModel = DefineMap.extend({
    title: {
        value: 'spotwizard.org',
        serialize: false
    },
    page: 'string'
});
于 2018-02-12T18:48:29.653 回答