Something went wrong installing the "sharp" module, on Mac M1 - node.js

I had been trying to resolve this issue and had tried running the app via rosetta terminal, but same issue persists. I tried installing the sharp package globally but that to did not help.
Here is a snippet of the error :-
I think the issue is something related to Sharp package specific for the arm architecture
I was trying to setup a repo on my system locally and simply ran yarn dev. I expected the server to start but the same error keeps coming again and again .

I think your problem is related to this conversation: https://github.com/lovell/sharp/pull/3514
Specifically "On an M1/M2 based machine, the dylib files provided by a globally-installed vips (via Homebrew or otherwise) will be ARM64, therefore we cannot use these when running Node.js under x64 emulation as there will be a runtime conflict."

Related

In the linked question, what does the op talk about regarding installing node.js in the working directory?

I am a complete newbie to all this.
I tried to install node.js 4 times and then again uninstalled it every time trying different things, thinking one of them would work.
The link to the question is-Cannot find runtime 'node' on PATH - Visual Studio Code and Node.js
After I typed $node --version in powershell terminal in VSCode (after installing node.js in C drive, defaulting to all recommended options in the setup) I get an error. I have uploaded the image of the error.
the error
Please tell me how to get node.js working with VSCode.
To get the version of Node, just type node --version in the terminal without the "$".

Electron build for windows shows sqlite3 error. But same build for Ubuntu Works

Packed using: Electron-Packager
Database: sqlite
The app uses Knex as a driver to query to mysqlite.
The module which it says that it cannot find is already present! But then too the error shows up.
I tried to navigate to the resource/app and then use commands like
npm run rebuild
tried installing python, node and then tried but seems like it required some CL.exe file so had to dowload Visual Studio C++ packages too but unfortunately it didn't have that file in my case.
Also tried
npm install sqlite3 --build-from-source
but got error
Can anyone help me with the exact steps to take? I also need help in knowing do i have to take this steps on the package that is already build or before i build it?
The best possible fix i got is the build the system in windows and then deploy it for windows. You need to google at every step where it breaks and then fix it. There are many possibilities and hence i cannot describe it here.

Electron throwing error %1 is not a valid win32 application with custom node addon

I've written a custom node addon that works perfectly fine when running the 64 bit version of Electron.
I tried setting the architecture to ia32 and everything builds, but I get the not valid win32 application error, no matter what I do.
My environment settings are:
npm_config_disturl=https://atom.io/download/atom-shell
set npm_config_target=1.0.1
set npm_config_arch=ia32
set npm_config_runtime=electron
set HOME="C:\Users\myHome\.electron-gyp"
set VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140
I have been building the addon by calling npm install.
Here's how I set my node to target 32 bit and install all packages in 32bit format. It works for me. You may try.
npm set npm_config_arch ia32
npm clean-install --arch=ia32
The first command set the node environment to 32bit.
The second command re-install all the node packages that are 32bit compatible.
I was trying to compile for windows from mi Mac and I had that problem too, but after some readings I figured out how to proceed, and after all I can say that I got it. Yesterday I spent all day setting up a windows virtual machine in my (other) Linux laptop (I used my linux laptop just because my mac was exhausted in storage...). I was having too a problem with the preloadScript from electron main process in windows, Cant found the script, it was solved too.
Anyway, I think the library node printer from #tojocky is well maintained, in other hand in the electron-builder documentation they say that you should compile in native for natural reasons. Once you will have it, you'll see that it's a cleaner and pragmatic solution ...
This was my entire process, I hope it helps to someone having the same issue:
Get VirtualBox (or Parallels but is not free)
Get iso for W10
Create a VM with this W10 iso, and you should give to this VM some storage (because some dependency that you'll need to compile), I have assigned 60gb to this VM
Once I had that VM running, I just installed in that machine Visual Studio 2017 (with their build-tools included, it's necessary)
And then, I used CMD to make the rest
Install NodeJS (and NPM, but it comes with)
Install node-gyp globally
Install Python 2.7
Clone your project from git (in my case)
npm i (in your project), you should have as npm dependency in your package.json the module electron-builder of course. (here I had some troubles because when node-gyp tried to rebuild printer to generate the binary for windows it was failing, this was because it was imposible to find the python executable, so if you face this problem you should add it like:npm config set python "c:\Python27\python.exe" in my case )
Then try again npm i and Voila!
After all, you should make the build using electron-builder, in my case my npm script command was build --win --x64 but you can use the --ia32 flag as well for 32bits

Node.js installation error

I tried to install node.js on a Windows 8 machine, but I got the following error:
The cabinet file 'media1.cab' required for this installation
is corrupt and cannot be used. This could indicate a network error, an
error reading from the the CD-ROM, or a problem with this package.
I downloaded the installation file from the node.js website at http://nodejs.org/download/.
How I can solve this problem.
My system specifications are OS : Windows8 32bit, RAM : 4GB, CPU :
Intel Pentium P6200, 2.13Gz, Dual Core
I was experiencing the same error message trying to install on Windows 7.
I was able to fix this issue and successfully install by:
changing the directory for installation.
Instead of installing within my "Program Files (X86)" folder, I installed into my "Program Files" folder
My suggestion is to try installing to a different directory as this solved the problem for me.
For anyone stumbling here, my problem (on win 7) was I accidentally downloaded the 32-bit version by mistake. Getting the 64-bit version was the solution.
Actually above none of answers ara not worked for me. I'm using windows 8.1 x64 . So i'm trying install nodejs.msi. Actually i can not install it. So i have used Chocolatey package manager. This is the command that i used for install nodejs. choco install nodejs.install Thats all it worked :)

"Process out of memory" when running Node.js or NPM on Mac OSX 10.5

I am completely new to both Macs and Node.js, so sorry if this one is a bit basic.
I am running Mac OS X 10.5 (Leopard) and have just installed the last version of Node.js (released version, not built from source).
Whenever I attempt to run Node or do an NPM install, I get the following error message:
FATAL ERROR: CodeRange::GetNextAllocationBlock Allocation failed - process out of memory
Does anyone know what the problem is? If not, what would be the next steps to figure this out?
Edit: It turns out that if I run these commands a few times then they eventually work. So my work-around is to keep repeating the command until I get success. This is better than nothing but still not acceptable. Software like WebStorm, which needs to execute these tools, doesn't know about this workaround and fails all the time.
The issue seems to show up when running the distributed build of Node on anything pre OSX 10.6.
You can manually build the binary yourself if you don't have the option to upgrade your OS.
http://therobotsbrain.blogspot.com.au/2012/03/installing-nodejs-on-os-x-105.html
I'm running X.5.8, and node 0.10.13 was giving me this error message. I tried some earlier versions of node, and 0.10.3 works while 0.10.4 gets the error message. This is the x86 version, x64 seems to crash at .3 but works at .0. Oh wait, it's more complicated than that. Seems to make a difference when I make a symlink to the app in /usr/local/bin, it crashes. more often. Try a few different ones see which work for you.
I really need to get a new laptop.
download here: http://nodejs.org/dist/

Resources