Error: Module parse failed: Unexpected character '?' (1:0)


#1

After reinstalling node (v. 8.11.2) and npm (v. 5.6.0) with many problems, I encounter a runtime error in the built main.js.

I would appreciate any help to solve it. I am running ionic-3.

Error: Module parse failed: Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
vendor.js:228175:7
<anonymous>
http://localhost:8100/build/vendor.js:228175:7
__webpack_require__
bootstrap%20ee12f3211282abe7895e:54
<anonymous>
index.js:6
<anonymous>
index.js:1
__webpack_require__
bootstrap%20ee12f3211282abe7895e:54
<anonymous>
index.js:2
__webpack_require__
bootstrap%20ee12f3211282abe7895e:54
<anonymous>
stream.js:22
<anonymous>
stream.js:1
__webpack_require__
bootstrap%20ee12f3211282abe7895e:54
<anonymous>
index.js:39:16
<anonymous>
index.js:1
__webpack_require__
bootstrap%20ee12f3211282abe7895e:54
<anonymous>
index.js:21
__webpack_require__
bootstrap%20ee12f3211282abe7895e:54
<anonymous>
booth.js:15:18
<anonymous>
booth.js:1
__webpack_require__
bootstrap%20ee12f3211282abe7895e:54
[186]
http://localhost:8100/build/main.js:874:73
__webpack_require__
bootstrap%20ee12f3211282abe7895e:54
[71]
http://localhost:8100/build/main.js:2339:69
__webpack_require__
bootstrap%20ee12f3211282abe7895e:54
[62]
http://localhost:8100/build/main.js:2101:79
__webpack_require__
bootstrap%20ee12f3211282abe7895e:54
[184]
http://localhost:8100/build/main.js:254:77
__webpack_require__
bootstrap%20ee12f3211282abe7895e:54
[485]
http://localhost:8100/build/main.js:1664:77
__webpack_require__
bootstrap%20ee12f3211282abe7895e:54
[434]
http://localhost:8100/build/main.js:1548:73
__webpack_require__
bootstrap%20ee12f3211282abe7895e:54
[412]
http://localhost:8100/build/main.js:1530:70
__webpack_require__
bootstrap%20ee12f3211282abe7895e:54
webpackJsonpCallback
bootstrap%20ee12f3211282abe7895e:25
<anonymous>
http://localhost:8100/build/main.js:1:1

This is the build run:

[00:12:58]  watch started ...
[00:12:58]  build dev started ...
[00:12:58]  clean started ...
[00:12:58]  clean finished in 6 ms
[00:12:58]  copy started ...
[00:12:58]  deeplinks started ...
[00:12:58]  deeplinks finished in 53 ms
[00:12:58]  transpile started ...
[00:13:07]  transpile finished in 8.45 s
[00:13:07]  preprocess started ...
[00:13:07]  preprocess finished in 1 ms
[00:13:07]  webpack started ...
[00:13:07]  copy finished in 8.86 s
[00:13:24]  webpack finished in 17.07 s
[00:13:24]  sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[00:13:27]  sass finished in 3.53 s
[00:13:27]  postprocess started ...
[00:13:28]  postprocess finished in 284 ms
[00:13:28]  lint started ...
[00:13:28]  build dev finished in 29.75 s
[00:13:28]  watch ready in 29.89 s
[00:13:28]  dev server running: http://localhost:8100/

And sometimes the build fails giving this error message:

Error: ./node_modules/zeromq/build/Release/zmq.node
Module parse failed: Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)

My ionic info:

cli packages: (/usr/lib/node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.1.9
Cordova Platforms  : none
Ionic Framework    : ionic-angular 3.9.2

System:

Node : v8.11.2
npm  : 5.6.0
OS   : Linux 4.4

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro

#2

Hi@Sunzu
try this

1.rm -rf node_modules
2.npm install

#3

Thanks, @vibinflogesoft I already tried it many times. I have also

  • npm cache clean --force
  • reinstalled ionic and cordova
  • tried different versions of node/npm with nvm

Nothing! Still getting the same error.