Comments (11)
I checked cli.js in the repository before and this file is correct, there is no CR newline in it, CR newline only appears in npm packages.
CR newlines may affect shebang instructions in linux, this discussion explains the issue:
https://unix.stackexchange.com/questions/108588/shebang-line-not-working-with-cr-lf
from bytenode.
I haven't used Notepad in years. If your diagnosis is correct, it might be Git for Windows that injected those characters.
I will check and publish a fix now.
from bytenode.
I cannot find any \r
characters in cli.js
file. Also, the version 1.5.4
works properly on my linux machine.
from bytenode.
I cannot find any characters in file. Also, version works properly on my linux machine.
\r``cli.js``1.5.4
That's weird, take a look at this file, it's from version 1.5.4 in npm: https://www.npmjs.com/package/bytenode/file/67b5f06b0fb3f124eed4c381c2515e315fb32637052f933954162a2ba703db15
cli.js in v1.5.3:
from bytenode.
npm pack [email protected]
Try this command to download the tar.gz package, and then check the cli.js file inside. I can see that CRLF newlines are indeed used in it.
from bytenode.
Anyway v1.5.4 will not work in the node:21-alpine3.19
container, just because there are CR newlines in it.
from bytenode.
That's weird, take a look at this file, it's from version 1.5.4 in npm: https://www.npmjs.com/package/bytenode/file/67b5f06b0fb3f124eed4c381c2515e315fb32637052f933954162a2ba703db15
I downloaded this file, and again, I cannot find any \r
characters in it.
npm pack [email protected]
Try this command to download the tar.gz package
Again, I downloaded the package, and no \r
in there.
The images you provided shows that the file is auto-detected to have CR+LF newlines. However, if you actually search for \r
, you will find none.
Anyway v1.5.4 will not work in the node:21-alpine3.19 container, just because there are CR newlines in it.
I tested Node v20.x on my machine. I will test Node v21.x later and get back to you.
from bytenode.
This is not possible, maybe you can try to use hex editor or xxd command to view the file in hex mode.
VSCODE HEX EDITOR
XXD
$ md5sum cli.js
ed03d365e1dfd03aedc768663b77c569 *cli.js
$ xxd cli.js
00000000: 2321 2f75 7372 2f62 696e 2f65 6e76 206e #!/usr/bin/env n
00000010: 6f64 650d 0a0d 0a27 7573 6520 7374 7269 ode....'use stri
00000020: 6374 273b 0d0a 0d0a 636f 6e73 7420 6673 ct';....const fs
00000030: 203d 2072 6571 7569 7265 2827 6673 2729 = require('fs')
00000040: 3b0d 0a63 6f6e 7374 2070 6174 6820 3d20 ;..const path =
00000050: 7265 7175 6972 6528 2770 6174 6827 293b require('path');
from bytenode.
Reproducible environment:
ENV
Docker Desktop+WSL2
Docker version 25.0.3, build 4debf41
WSL version : 2.1.4.0
kernel version : 5.15.146.1-2
WSLg version : 1.0.60
MSRDC version : 1.2.5105
Direct3D version : 1.611.1-81528511
DXCore version : 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version : 10.0.22631.3155
Dockerfile:
FROM node:21-alpine3.19
RUN yarn global add bytenode
WORKDIR /app
SHELL
docker build . -t app
docker run -it app:latest sh
/app # vi /usr/local/bin/bytenode ## saw CR newlines(^M)
/app # bytenode -v
': No such file or directory
/app #
from bytenode.
This is weird. The md5sum cli.js
from the package is indeed ed03d365e1dfd03aedc768663b77c569
. However, if you clone the repository and run md5sum cli.js
, it is fbea827b80fab18279151221306b238e
.
Now, the most likely reason is that my Git was configured to automatically add CRLF upon checkout and commit LF. So, no CR characters were leaked into the git repository. However, when I used npm publish
, it packed the local version where the CR characters exist.
But, this does not explain why the version 1.5.4
works on my machine. Maybe it's docker related issue?
Anyways, I published a new version now 1.5.5
. Let me know if it fixes your issue.
from bytenode.
I tested the v1.5.5 version and now it works fine in the environment, GREAT!
Thank you for the great work!
Dockerfile:
FROM node:21-alpine3.19 as init-env
RUN yarn global add [email protected]
docker run -it test sh
/ # bytenode -v
bytenode 1.5.5
Node 21.7.0
/ # vi /usr/local/bin/bytenode ## NO CR newlines now;
from bytenode.
Related Issues (20)
- cli no exitcode when compile HOT 2
- Node.js version, or v8 version? HOT 2
- load compressed bytecode HOT 11
- 开发含有native插件打包加密时,会有问题,检查过代码,怀疑是bytenode的问题 HOT 1
- Electron crashes on any undefined value HOT 15
- Error: Invalid or incompatible cached data (cachedDataRejected) HOT 8
- ncc
- feat: Accept path to Electron as a compile argument
- bug: Electron builds use 2 subprocesses
- Source map support to trace production errors HOT 5
- Error: cannot find module 'node:assert/strict' HOT 11
- WDIO8/Bytenode compatibility regression
- 1.5.2 bug ': No such file or directory HOT 1
- toString issue clarification HOT 1
- Can "fixBytecode" done when complie?
- Compiling with a file pattern *.js does not work on Windows HOT 2
- 这也许是一个bug
- require('node:assert/strict')导致低版本不能用
- bytenode cli returns a success exit code even if unable to compile script HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bytenode.