我正在運行版本1.7.5,並且出於一些不可理解的原因,突然間我收到語法錯誤(自從它工作以來,我的樣式表都沒有更改)和我,包括相同的方式.js文件):對象不支持這個動作 - 突然間
Object doesn't support this action
我跟蹤的誤差這種奇怪的片段(線7880):
new(less.Parser)(env).parse(data, function (e, root) {
if (e) { return callback(e, null, null, sheet); }
try {
callback(e, root, data, sheet, webInfo, path);
} catch (e) {
callback(e, null, null, sheet);
}
}, {modifyVars: modifyVars, globalVars: less.globalVars});
...在loadStyleSheet
功能。我不明白的語法,其實和在控制檯我得到同樣的錯誤消息,嘗試它:
new(less.Parser) # fails
new(less.Parser)(env) # fails
typeof less.Parser # yields "function"
這到底是怎麼回事呢?
description: "Object doesn't support this action" message: "Object doesn't support this action" number: -2146827843 stack: "TypeError: Object doesn't support this action\n at Parser (http://localhost:53109/Scripts/System/less-1.7.5.js:360:5)\n at Anonymous function (http://localhost:53109/Scripts/System/less-1.7.5.js:7880:13)\n at Anonymous function (http://localhost:53109/Scripts/System/less-1.7.5.js:7838:13)\n at handleResponse (http://localhost:53109/Scripts/System/less-1.7.5.js:7763:13)\n at doXHR (http://localhost:53109/Scripts/System/less-1.7.5.js:7783:9)\n
at loadFile (http://localhost:53109/Scripts/System/less-1.7.5.js:7832:5)\n at loadStyleSheet (http://localhost:53109/Scripts/System/less-1.7.5.js:7856:5)\n at loadStyleSheets (http://localhost:53109/Scripts/System/less-1.7.5.js:7896:9)\n at less.refresh (http://localhost:53109/Scripts/System/less-1.7.5.js:7973:5)\n at Anonymous function (http://localhost:53109/Scripts/System/less-1.7.5.js:7999:1)"
*更新I *
這樣的語法似乎是確定。我可以這樣做:
new(function() {})('x')
所以鑑於less.Parser
是一個函數的代碼應該工作...但事實並非如此。這裏是我得到的,如果我看看less.Parser
:
function Parser(env) {
var input, // LeSS input string
i, // current index in `input`
j, // current chunk
saveStack = [], // holds state for backtracking
furthest, // furthest index the par
[Methods]: {...}
__proto__:
function() {
[native code]
}
arguments: null
caller: null
length: 1
prototype: {...}
做什麼看起來不對?
*更新II *
實現1.7.5遠遠當前的背後,我升級到2.5.0(右關CDN),但現在它在其他地方休息(線2440):
if (typeof Object.create === 'undefined') {
var F = function() {};
F.prototype = Error.prototype;
LessError.prototype = new F();
} else {
LessError.prototype = Object.create(Error.prototype); # breaks here
}
與錯誤:
Object.create: argument is not an Object and is not null
,如果我看Error.prototype
我得到undefined
... ... GRR
自工作以來發生了哪些變化?你升級少了嗎?你有升級其他軟件包嗎?如果你真的使用npm,你有沒有試過吹掉'node_modules'目錄並執行'npm install'? – Cymen
我沒有使用npm,並且仔細查看了我對該項目所做的每一項更改,我沒有看到任何可以解釋這一點的內容 – wintersylf