I am trying to install the this node-printer npm package. There is a pre built node build section under which there is:
npm install printer --target_arch=ia32
npm install printer --target_arch=x64
Googling pre build node built did not hep me much. Searching for arget_arch=ia32 took me electron github issue page but I could not understand what it meant either
target_arch option seems to be coming from node-pre-gyp which node-printer runs as install script after it is installed.
By "prebuilt", that means you won't have to build the C++ code yourself. It is pre-built (== built in advance) by the node-printer package.
Related
While install owasp jUice shop when i enter npm start it doesn't work for me i tried lots of methods but it stuck..
Error: The module '/home/kali/Downloads/juice-shop_9.3.1/node_mpdules/libxmljs2/build/xmljs.node'
Was compiles against a
different node.js version using NODE_MODULE_VERSIONB64.
This version of Node.js
requires NODE_MODULE_VERSIONB 93.
I tried to recompiling and reinstalling
When i again install npm install it says
Unsupported engine i tries lots of ways but nothing works for me
I'm doing it in my kali machine
You need to recompile the binaries for your new Node version with npm rebuild.
I'm using Rosetta 2 with Homebrew and have sqlite3 installed.
I added these to my ~/.zshrc so that the node compiler can find the brew installs:
export PATH="/usr/local/opt/sqlite/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/sqlite/lib"
export CPPFLAGS="-I/usr/local/opt/sqlite/include"
I'm using installing using npm install sqlite3, building from source with --build-from-source flag, I'm also specifying the homebrew version of sqlite with --sqlite=/usr/local/opt/sqlite/
node-gyp goes to its fallback build node-pre-gyp install --fallback-to-build
After installation, I'm rebuilding it's native dependencies with electron-builder and install-app-deps
It even rebuilds to the platform and arch I'm looking for, darwin and x64. Which is promising.
• electron-builder version=23.0.3
• loaded parent configuration preset=react-cra
• rebuilding native dependencies dependencies=sqlite3#5.0.8 platform=darwin arch=x64
However, when run the app with npm run dev which runs concurrently " cross-env BROWSER=none npm start" "wait-on http://localhost:3000 && electron ."
It still is trying to find the arm64 version of it:
Error: Cannot find module '[..]/node_modules/sqlite3/lib/binding/napi-v6-darwin-unknown-arm64/node_sqlite3.node'
Even though I can confirm, it did build the x64 version because I have one located at:
/napi-v6-darwin-unknown-x64/node_sqlite3.node
Any help to get this working would be greatly appreciated, thanks!
After 4 days of digging, I have finally gotten it to work!!!
For anyone that might stumble on this:
The reason why sqlite3 won't behave is threefold:
When node sqlite3 is installed using npm install sqlite3, it fetches all dependencies and installs it. It then fetches the precompiled binary binding file for the target arch and platform. In my case we would want napi-v6-darwin-unknown-arm64 for ARM64 and darwin for Apple M1. There is no precompiled binary available yet for this Apple ARM64 and even if there is, the next paragraph will detail why it still won't work.
The problem is that it determines the the system's platform and architecture using the binary compiling package node-pre-gyp and this very savior of a Github issue details how node-pre-gyp is not handling ARM architecture detection properly and basically mixing everything up. Because it's not detecting properly, even if we build our own binding with --build-from-source when installing, it still won't work because it is compiling the wrong binding file for the wrong architecture. To make matters worse, if we don't use --build-from-source, it just simply fetches the Intel precompiled binding file. napi-v6-darwin-unknown-x64
Now for some reason, during runtime, it now detects the architecture properly and tries to look for the ARM64 version of the binding file, it won't find it and will throw the feared error 'module not found' for napi-v6-darwin-unknown-arm64. It obviously won't find it and even if it does, it will throw wrong architecture error because we have the Intel version on board napi-v6-darwin-unknown-x64.
So finally after digging at this for 4 days, here's how I got it working:
Uninstall sqlite3: npm uninstall sqlite3
Install a fresh sqlite3, build it from source, specify the target arch and use fallback build with node-pre-gyp just to be safe: npm install sqlite3 --build-from-source --target_arch=arm64 --fallback-to-build
Now the correct binding file is compiled for the correct platform and architecture, on runtime it will find it and will run!
Installing scrypt using npm on windows is giving following error.
The build is failing due to node-gyp
From github documentation node-Gyp is listed as pre-requisite as it is required to build scrypt. Make it sure to install node-Gyp
using npm install -g node-gyp
For successfull working of this plugin you will also need to install all the required tools and configurations using Microsoft's windows-build-tools
using npm install --global --production windows-build-tools
from an elevated PowerShell or CMD.exe (run as Administrator).
for other options and alternatives follow node-gyp documentation
Before installing scrypt
Follow installation instructions given at github
For NodeJS 10.5.0 and higher
My answer could be a little bit out of topic, but I encountered a similar error with the installation of the scrypt library for NodeJS v12: during the compilation of the C/C++ modules with node-gyp a lot of compiling warnings and errors appear.
Though, there is an elegant solution.
Since version 10.5.0 NodeJS has a crypto.scrypt(...) function, which (with several other functions from crypto module) could cover almost all real use-cases.
So, a decent solution could sound like: Remove scrypt-package from your code and use the appropriate functions from the crypto-native module.
Sadly, but in most cases it is not the best solution for a real business
first you need to install windows-build-tools
run this command first
> npm install --global --production windows-build-tools
I'm using JointsWP (an excellent Foundation 6 port to Wordpress).
I'm using the Sass version and it's working great. However, I seem to have to install npm with every project. Is this nessesary?
Is there a way to install npm globally and link to it from my project? Or have the project find it automatically?
I think you are confused about what the command npm install actually does. npm install installs all the npm dependencies for your project into the node_modules directory. It doesn't actually install npm. To run npm install you have to have Node.js installed (npm is included with node).
So to answer your question, yes it is necessary to run npm install for every project.
Relevant Article: Global vs Local installation
The article above shared by Colin Marshall is great and sums up the answer perfectly.
In general, the rule of thumb is:
If you’re installing something that you want to use in your program,
using require('whatever'), then install it locally, at the root of
your project. If you’re installing something that you want to use in
your shell, on the command line or something, install it globally, so
that its binaries end up in your PATH environment variable.
So to answer your question, is it possible? Yes.
Is it recommended? No.
https://nodejs.org/en/blog/npm/npm-1-0-global-vs-local-installation/
You can install gulp sass globally with the command:
npm install -g gulp-sass
I'm trying to install the express framework for node.js. However, whenever i run "sudo npm install express", i never get a response. It just sits there. Im seriously frustrated at this point.
Using npm 1.0.22 on OSX Lion
I had this issue on lion as well. It was because Lion removed xcode from my path and at some point, the express install triggered gcc.
Try this to pinpoint your problem, it will turn on verbose npm output and is a great way to debug npm packages:
npm config set loglevel info
If your problem does turn out to be a lack of gcc, first see if it's already installed in: /Developer/usr/bin and if not, use the 'app store' to reinstall.
Here's more info on the gcc issue: http://www.quora.com/What-is-the-path-for-gcc-in-Mac-OS-X-Lion
You may be running node v0.5.5-pre which doesn't fall within the required version numbers for the npm package. I found some "answers" here.
To fix I downloaded the 0.4.11 tar.gz from the node.js main page and did a manual build/install: (./configure ; sudo make install) and ran npm install express again, which worked fine this time.