类型错误: 无法读取未定义的源节点的属性'substr'.js



此错误是由于解决了这个问题而产生的

这是我ionic info

Cordova CLI: 6.5.0
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v7.4.0
Xcode version: Not installed

(我也在使用 npm v4.1.1

尝试构建@ionic/app-scripts时,我收到以下错误:

E:DocumentsYear_3Mobile_Application_Developmentmammoth-v2node_moduleswebpack-sourcesnode_modulessource-maplibsource-node.js:95
      var code = nextLine.substr(0, mapping.generatedColumn -
                         ^
TypeError: Cannot read property 'substr' of undefined
    at Function.<anonymous> (E:DocumentsYear_3Mobile_Application_Developmentmammoth-v2node_moduleswebpack-sourcesnode_modulessource-maplibsource-node.js:95:30)
    at Array.forEach (native)
    at BasicSourceMapConsumer.SourceMapConsumer_eachMapping [as eachMapping] (E:DocumentsYear_3Mobile_Application_Developmentmammoth-v2node_moduleswebpack-sourcesnode_modulessource-maplibsource-map-consumer.js:155:14)
    at Function.SourceNode_fromStringWithSourceMap [as fromStringWithSourceMap] (E:DocumentsYear_3Mobile_Application_Developmentmammoth-v2node_moduleswebpack-sourcesnode_modulessource-maplibsource-node.js:80:24)
    at SourceMapSource.node (E:DocumentsYear_3Mobile_Application_Developmentmammoth-v2node_moduleswebpack-sourceslibSourceMapSource.js:42:20)
    at ReplaceSource.node (E:DocumentsYear_3Mobile_Application_Developmentmammoth-v2node_moduleswebpack-sourceslibReplaceSource.js:69:29)
    at CachedSource.node (E:DocumentsYear_3Mobile_Application_Developmentmammoth-v2node_moduleswebpack-sourceslibCachedSource.js:12:23)
    at E:DocumentsYear_3Mobile_Application_Developmentmammoth-v2node_moduleswebpack-sourceslibConcatSource.js:40:49
    at Array.map (native)
    at ConcatSource.node (E:DocumentsYear_3Mobile_Application_Developmentmammoth-v2node_moduleswebpack-sourceslibConcatSource.js:39:60)

如果需要,当我运行npm run build(构建@ionic/app-scripts时,这是构建日志:

[07:28:45]  ionic-app-scripts 1.0.0 
[07:28:45]  build dev started ...
[07:28:45]  clean started ...
[07:28:45]  clean finished in 4 ms
[07:28:45]  copy started ...
[07:28:45]  transpile started ...
[07:28:49]  transpile finished in 4.44 s
[07:28:49]  webpack started ...
[07:28:49]  copy finished in 4.57 s
            **errors arise here**

编辑:

我添加了配置:

"config": {
    "ionic_generate_source_map": false
},

packages.json似乎修复了错误,但现在我面临着另一个错误:

Error: ENOENT: no such file or directory, open 'main.js.map'

当我尝试做ionic serve时会抛出它(@ionic/app-scripts的构建现在工作得很好)

编辑#2:

ionic是否依赖于源映射来运行?由于错误是由于构建了非

此错误来自一个 ts 文件中有两个 2 类/组件。

解决这个问题的残酷方法。

将要node_modules\webpack-sourcesode_modules\source-map\lib\source-map\source-node.js

并交换所有 2 次,这似乎:

var nextLine = remainingLines[0];

对此

var nextLine = remainingLines[0] || '';

此解决方案的问题在于您无法将其置于版本控制中,因为这是节点模块

我添加了配置:

"config": {
    "ionic_generate_source_map": false
},

。到包.json,这似乎可以修复错误。

在上面的编辑中,我现在描述了我遇到的另一个错误

我解决此问题的方法是将此配置选项添加到package.json中:

"config": {
    "ionic_source_map_type": "eval"
}

相关内容

  • 没有找到相关文章

最新更新