This error comes as a result of resolving this question
Here is my 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
(I am also using npm v4.1.1
)
When attempting to build @ionic/app-scripts
, I am getting the following error:
E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\node_modules\source-map\lib\source-node.js:95
var code = nextLine.substr(0, mapping.generatedColumn -
^
TypeError: Cannot read property 'substr' of undefined
at Function.<anonymous> (E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\node_modules\source-map\lib\source-node.js:95:30)
at Array.forEach (native)
at BasicSourceMapConsumer.SourceMapConsumer_eachMapping [as eachMapping] (E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\node_modules\source-map\lib\source-map-consumer.js:155:14)
at Function.SourceNode_fromStringWithSourceMap [as fromStringWithSourceMap] (E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\node_modules\source-map\lib\source-node.js:80:24)
at SourceMapSource.node (E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\lib\SourceMapSource.js:42:20)
at ReplaceSource.node (E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\lib\ReplaceSource.js:69:29)
at CachedSource.node (E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\lib\CachedSource.js:12:23)
at E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\lib\ConcatSource.js:40:49
at Array.map (native)
at ConcatSource.node (E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\lib\ConcatSource.js:39:60)
If needed, when I run npm run build
(to build @ionic/app-scripts
), this is the build log:
[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**
EDIT:
I added the configuration:
"config": {
"ionic_generate_source_map": false
},
...to packages.json
which seemed to fix the error but am now faced with another one:
Error: ENOENT: no such file or directory, open 'main.js.map'
Which is thrown when I attempt to do ionic serve
(the build of @ionic/app-scripts
works just fine now)
EDIT #2:
Does ionic
rely on a source map to run? As the error is arising because non are built
This error comes from having two 2 classes/components in one ts file.
A brutal way to fix this.
Is going to node_modules\webpack-sources\node_modules\source-map\lib\source-map\source-node.js
And exchanging all 2 times this appears:
var nextLine = remainingLines[0];
To this
var nextLine = remainingLines[0] || '';
Problem with this solution is that you can't put it into version control since this is node modules
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With