Closed pengjinning closed 4 weeks ago
could be a backspace? a lot of mixed text ends up with half characters that don't display frmo someone deleting one byte of a two-byte character
Getting the same error here too.
Node 8.4.0 Ionic 3
Uncaught Error: Module parse failed: ***/node_modules/nodejieba/build/Release/nodejieba.node Unexpected character '�' (1:0)
Any idea how to stop this ?
I can't use it in electron, same error. Have tried ./node_modules/.bin/electron-rebuild
Same problem with this ***/node_modules/nodejieba/build/Release/nodejieba.node file
it's loading a binary file
Unexpected character '�' (1:0) You may need an appropriate loader to handle this file type. (Source code omitted for this binary file)
I've seen those type of characters before when encoding gets messed up eg utf8 / shiftJIS. but not sure for binary files
is this a win/unix thing with the 'BOM' issue?
@pengjinning @yanyiwu
Hey. I just ran into this issue while transpiling my server code.
Looks like it's failing because the library imports a .node
file on line 1.
var nodejieba = require( __dirname + "/build/Release/nodejieba.node");
I fixed it by including the node-loader
loader for .node
files in my webpack.config.js file.
module: {
rules: [
{
test: /\.node$/,
use: 'node-loader',
},
// other loaders come after
]
}
This worked for me. Not sure if my use-case for this similar to yours but give this a try. 🙂
good find @abinavseelan can you send a PR 🗡
@dcsan That cannot be fixed in nodejieba's side. To use it should change the config of project's webpack. Though, it still can't be used in electron.
This issue has not been updated for over 5 years and will be marked as stale. If the issue still exists, please comment or update the issue, otherwise it will be closed after 7 days.
This issue has been automatically closed due to inactivity. If the issue still exists, please reopen it.
node v8.0.0 + laravel v5.4 + vue v2.3.3 报错:
ERROR Failed to compile with 1 errors 11:42:52
error in ./~/.2.2.5@nodejieba/build/Release/nodejieba.node
Module parse failed: /Users/ningjinpeng/Sites/admin/node_modules/.2.2.5@nodejieba/build/Release/nodejieba.node Unexpected character '�' (1:0) You may need an appropriate loader to handle this file type. (Source code omitted for this binary file)
@ ./~/.2.2.5@nodejieba/index.js 1:16-69 @ ./resources/assets/js/bootstrap.js