-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot install the package using node v16 #1711
Comments
I tried installing with node v14, it worked. At the same time installing |
I'm unable to reproduce the problem on macOS. Both node v14 and node v16 work fine for me. In addition, I suspect there is more useful information in the log that was omitted when you copied the last few lines. The copied lines only seem to indicate that there was an error but doesn't say what the cause was. |
I'm having the same problem installing esbuild using node v16 on Ubuntu 21.04. Strangely I did not have this issue using WSL on Windows or on Mac. Here's the full log file for Edit: ignoring the postinstall script ( |
I am also facing same issue. OS: Ubuntu 20.04
npm ERR! code 1 npm ERR! A complete log of this run can be found in: |
Unfortunately even that full log doesn't provide enough information. And I'm still not able to reproduce this with these instructions on my Linux VM. Here's what I tried:
It seems to work fine. I'm going to close this issue because realistically there's nothing I'm going to be able to do about it. If someone is experiencing it themselves then it would be great if they could debug it and post here about what the problem is. If the problem is identified, then the issue can be reopened. To debug this what you'll want to do is download the
You can make whatever edits you want to the install script in the
|
Hi @evanw , thanks for suggesting a debugging approach, I have followed your instructions, and did setup the following test harness:
Where the top level directory
Running
Adding a node js shebang to and:
I'm not sure what are the consequences for all possible operating system, but maybe is something worth looking at. |
That's very strange because the log line I can add that shebang line because it's harmless (node strips it before it runs the code). But I'm not sure that will actually fix your problem. Side note: I believe the log line is actually |
Good observation, this is a screenshot of what I see: No quotes indeed. From the file you linked above, it seems node determines how to run the script, and chooses to run it as For reference, the first thing I tried was running the script directly with node:
Which reaches the
This made me think that there's probably nothing wrong with the install script, but with the way it is executed, hence trying the first thing that came to mind which was adding a shebang... |
I think what happens is that See this:
|
@grancalavera The addition of the shebang line has been released in version 0.14.14: https://unpkg.com/esbuild@0.14.14/install.js. Does that fix the problem for you? |
Hi @evanw, no sadly it doesn't work. I'm sure I made a mistake while testing during the weekend. I wrote a little test harness and now I can make it fail consistently: VERSION=0.14.14
rm -rf esbuild project
curl -O https://registry.npmjs.org/esbuild/-/esbuild-"${VERSION}".tgz
tar xf esbuild-"${VERSION}".tgz
rm esbuild-"${VERSION}".tgz
mv package esbuild
mkdir project
cd project
npm init -y
npm install ../esbuild That fails the same way as before:
I'll look into it a bit more. |
There's a report that using node 17.4 fixes this issue: #1973 (comment). If someone who is able to reproduce this issue has the time to debug this, it would still be very useful to understand how far the install script gets before it fails and what's causing it to fail. |
Hi, I got the same error on my machine.
I used the script by @grancalavera to have full control over the installed esbuild version. I just changed the install command to this:
This helps to see all messages from the I added some more logging and the error seems to be caused by this line in downloadedBinPath, where Comparing the log results, it is the exact same error which I would get when calling I hope this helps. |
Replacing each line of
Some notes to reproduce this issue:
@evanw, what do you think? Is this fix ok? Should I open a PR? |
Thanks for the research. This is valuable progress! I do still wonder what's actually going on though (why Edit: I just put together a new VM and I think I can reproduce it when node is installed with snap. Currently investigating. |
I was finally able to reproduce this issue in a new VM. I had to install node via snap instead of downloading the official version to reproduce the issue. But when I debug the failure in my VM, I confusingly narrowed the issue down to the fact that stdout and stderr aren't writable? I tried an install script only containing one line that writes to stdout in a few different ways: // This "install.js" file installs fine
console.log('test'); // This "install.js" file throws "Error: EACCES: permission denied, write"
process.stdout.write('test\n'); // This "install.js" file also throws "Error: EACCES: permission denied, write"
require('fs').writeSync(1, 'test\n'); I don't understand why this is happening or why These test cases were reduced down from the original problem which was that I seem to be able to fix that problem by adding
So maybe the underlying issue here is that when node is installed via snap, stderr is somehow not writable from install scripts? |
I just released version 0.14.17 with my fix described above and I have verified that it fixes the issue for me. I can no longer reproduce the issue in my VM with the latest version of esbuild. Any chance that fixes esbuild installation for anyone who couldn't install esbuild before? |
Hi @evanw, I'm super sorry, but double checking my test-setup I found out I was actually debugging an error caused by the test setup itself. 🤦 Your patch fixed it 😄 |
I just had this error when using Snap NodeJS, but no issues when using NodeSource NodeJS. |
@yabuking84 did you try the latest esbuild release? did this fix the issue? |
I'm seeing still issues on Ubuntu, using node install with nvm
|
It looks like it’s saying it can’t even find the install script in the first place? That’s a problem with npm/node, not with esbuild. The install script is published in that location as part of the esbuild package. |
@JamesBoon |
I can confirm that change from
to
fixes the issue I initially described Thanks for the fix! |
This solved my issue running |
@evanw it's worth mentioning that if you're
|
I had the same issue in UBUNTU 23.04 then i run npm i esbuild and it worked |
/home/keqing/Mocap-Drones/computer_code/node_modules/esbuild/install.js:117 SyntaxError: Unexpected token { |
Optional catch bindings are supported in node ≥10, and esbuild requires node ≥12. So |
Thanks for the reply, after I upgraded nodejs to v16, yarn install passed!
Am
***@***.***
…------------------ 原始邮件 ------------------
发件人: "Evan ***@***.***>;
发送时间: 2024年4月3日(星期三) 上午9:24
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [evanw/esbuild] Cannot install the package using node v16 (Issue #1711)
Optional catch bindings are supported in node ≥10, and esbuild requires node ≥12. So } catch { shouldn't be a syntax error as long as you are using a supported version of node. If that happens because you're using a really old version of node, then you should update to a newer version of node.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
I am running
npm install --save-dev esbuild
in a folder with only package.json file and getting this output:Log file ends with following:
I am using
Ubuntu 20.04
The text was updated successfully, but these errors were encountered: