I'm trying to develop an electron app, and I would like to use an npm package that gives vibrancy to a window. This is the package I'm trying to use: https://github.com/sebascontre/windows10-fluently-vibrancy
It uses a visual c++ code to call native windows methods to achieve this vibrancy effect.
I've cloned and I've run the npm install and build as described in the readme and ran the following:
npm install
npm run conf
npm run rebuild
All built successfully and I also see the build\debug artifacts of the c++ build.
When I try to run it (as described in readme):
cd spec\app
electron .
I'm getting the following error message:
Uncaught Exception:
Error: The specified module could not be found.
\\?\F:\Development\windows10-fluently-vibrancy\build\Debug\Vibrancy.node
at process.func [as dlopen] (electron/js2c/asar.js:155:31)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:857:18)
at Object.func [as .node] (electron/js2c/asar.js:155:31)
at Module.load (internal/modules/cjs/loader.js:677:32)
at tryModuleLoad (internal/modules/cjs/loader.js:609:12)
at Function.Module._load (internal/modules/cjs/loader.js:601:3)
at Module.require (internal/modules/cjs/loader.js:715:19)
at require (internal/modules/cjs/helpers.js:14:16)
at bindings (F:\Development\windows10-fluently-vibrancy\node_modules\bindings\bindings.js:112:48)
at Object.<anonymous> (F:\Development\windows10-fluently-vibrancy\index.js:1:35)
According to the message it cannot find the Vibrancy.node file - But I've verified that it exists in the specified location.
Any ideas how to make it run? I have cloned the package to test it since when trying to use the npm itself in my project it gave the same error so I figured I would try the source.
Today I had the exact same issue you're describing here.
I got it to work using electron-rebuild.
From the root of your project run the command: electron-rebuild
Hope this helps you, if not, maybe someone else.
Related
I'm trying to run npm run gulp and I'm coming up with this primordials is not defined error (I have also added the npm-shrinkwrap.json file as suggested which gets updated after running npm install but it doesn't fix my primordials is not define error):
> gulp-tutorial#1.0.0 gulp
> gulp
fs.js:47
} = primordials;
^
ReferenceError: primordials is not defined
at fs.js:47:5
at req_ (/Applications/MAMP/htdocs/wordpress/wp-content/themes/theming-main/node_modules/natives/index.js:143:24)
at Object.req [as require] (/Applications/MAMP/htdocs/wordpress/wp-content/themes/theming-main/node_modules/natives/index.js:55:10)
at Object.<anonymous> (/Applications/MAMP/htdocs/wordpress/wp-content/themes/theming-main/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:1:37)
at Module._compile (node:internal/modules/cjs/loader:1095:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
Node.js v17.0.1
Any suggestions 🙌 ?
Primordials are used by Node.js internal modules and are not accessible to end user scripts. (That's their entire point for existing. Otherwise, you could modify Object.prototype and end up affecting Node.js internals, causing weird crashes and things like that.)
The module that is giving you this error is the natives module. The page for the package says:
This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs#4.x.
Sounds like it's at that point where it's broken. Use npm ls natives to find out what's using it. (You might need to be in the /Applications/MAMP/htdocs/wordpress/wp-content/themes/theming-main directory when you run the command.) From there, you can try to figure out how to get rid of it.
Another possibility would be to try downgrading to an earlier version of Node.js to see if it works with that version.
The problem was with the versions not matching up. I also had 2 NodeJS installation paths and that was throwing things off.
I uninstalled them all, started from the beginning and used brew to reinstall.
Then checked that the versions were all compatible.
I also had to install node-sass and referred to this compatibility table to get the correct version - https://github.com/sass/node-sass#node-version-support-policy
Now its working and I can get on developing :) As of today Im running Node v17.0.1 Npm v8.1.0 Gulp cli v2.3.0
I am trying to get CKEditor in my project with a custom build.
However, my problem is more general, so feel free to answer even if you don't use CKEditor.
Following the instructions to generate a custom build, I am getting a syntax error when running npm run build in terminal:
my/build/path/bin/create-entry-file.js:12
const { bundler } = require('#ckeditor/ckeditor5-dev-utils');
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:140:18)
at node.js:1043:3
Npm fails with a bunch of text and the above error. I believe this error is generated due to modern ECMAScript syntax, which is not recognized in my local machine.
However, the build I am trying to generate is there, complete and ready. Also, some other documentation of theirs, indicate more import {...} from syntax. This means that they are able to generate the build without the need of external packages (otherwise they would be in the package.json dependencies).
So, my question is, how do I install the software needed that will allow my npm to recognize and execute modern ES syntax ?
I am running on Ubuntu 16, with the lastest npm version: 5.6.0.
Thanks in advance, let me know if I can provide more information
Can you please check the version of Node on your computer?
Run in the terminal
node -v
You need to have at least 6.4 as your Node.js version according to this list on your computer
Here you have a link where you get and update to the newest version of Node 8.9.4 for different platforms. In your case check Linux
https://nodejs.org/en/download/
Has anyone been able to successfully install node-sass on IBM i?
I'm currently running Node 6.9.1, and am able to install many npm packages. However, the #angular/cli has a dependency on node-sass, and apparently, node-sass has a compiled component that is giving me grief to install.
My first issue had to do with being able to download the binary itself - because of our network setup, the IBM i was unable to download the binary from:
https://github.com/sass/node-sass/releases/download/v4.5.2/aix-ppc-48_binding.node
I was getting a timeout error. I was able to resolve that by changing the SASS_BINARY_SITE to the non-https version:
export SASS_BINARY_SITE='http://github.com/sass/node-sass/releases/download'
However, now, even though the binary downloads successfully, i get the following error when npm tries to test the binary:
Testing binary Binary has a problem: Error: Could not load module
/QOpenSys/QIBM/ProdData/OPS/Node6/lib/node_modules/node-sass/vendor/aix-ppc-48/binding.node.
The module has an invalid magic number.
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at module.exports (/QOpenSys/QIBM/ProdData/OPS/Node6/lib/node_modules/node-sass/lib/binding.js:19:10)
at Object.<anonymous> (/QOpenSys/QIBM/ProdData/OPS/Node6/lib/node_modules/node-sass/lib/index.js:14:35)
And then npm tries to build the binary locally, but fails because Python2 isn't available on this machine. I can request the installation of Python2, which is a long process in our environment, but before i continue down that rabbit hole, I'd like to know if it's actually possible to have node-sass working, and if so, is there another binary that i can point the npm install at to use instead.
Or, is there an alternative means of get node-sass working?
As of 2017 this will likely not be possible. In addition to Python you will need the entire cpp toolchain to build node and node addons. Since this is already a very hard requirement for desktop PCs, systems like that will have a even harder time. Judging from their binding.gyp, there is just support for OS X, Windows and Linux.
node-sass is known to be hard to build also across the node use base.
Very likely you rather want to have a build / CI step on Linux that compiles your SASS files and builds your artefact.
I'm trying to use edge.js to execute some .NET code to print on windows in an Electron app. I've tried electron-edge and I've also tried manually building the edge.js modules targeting Electron following the instructions in the Electron docs, but I keep getting the following error when I try to use edge in the packaged app:
Error: The specified module could not be found.
\\?\C:\path\to\app\app-1.0.0\resources\app.asar.unpacked\node_modules\edge\lib\native\win32\x64\6.5.0\edge_nativeclr.node
at Error (native)
at process.module.(anonymous function) (ELECTRON_ASAR.js:178:20)
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:178:20)
at Object.Module._extensions..node (module.js:583:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:192:18)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
I've checked the filesystem and the edge_nativeclr.node module does, in fact, exist. My suspicion is that I'm somehow not building the module correctly and it's perhaps targeting the wrong version of node still and so electron is unable to import the module.
I tried several different things, including following electron-edge's steps to manually update the build.bat and add the --target=1.4.12 --dist-url=https://atom.io/download/atom-shell flags to the node-gyp configure build.
I also set the following npm config options in my .npmrc:
target=1.4.12
arch=x64
target_arch=x64
disturl=https://atom.io/download/electron
runtime=electron
build_from_source=true
msvs_version=2015
And ran the build.bat, making sure to set the EDGE_NATIVE environment variable to point to the generated edge_nativeclr.node file, but got the same result.
I finally got this figured out after banging my head against the keyboard for a couple days. I got some hints from electron-userland/electron-packager#217 and electron/electron#892, which pointed out that this error, "The specified module could not be found," could occur when the native module is missing a dependency, such as a .dll, and that you could use Dependency Walker to check the dependencies of any given .node module.
I loaded edge_nativeclr.node in Dependency Walker and noticed that VCRUNTIME140.DLL, the Visual Studio 2015 C runtime, was missing. Edge.js comes with the msvcr120.dll, the Visual Studio 2013 C runtime, but I'd been rebuilding the module with the msvs_version set to 2015.
Once I placed a copy of the vcruntime140.dll in the same directory as edge_nativeclr.node, everything started working as expected.
I also got this error even though I did have VC++ Redistributable x64 installed correctly. It turns out the error in my case was not actually a problem since everything worked fine (I was able to run the electron-quick-start app with electron-edge).
Even so, the author has fixed the install so that the error does not occur. https://github.com/kexplo/electron-edge/issues/25#issuecomment-272908409
Aside note, if you load edge_nativeclr.node in Dependency Walker, you will see the VCRUNTIME140.DLL resolved properly (e.g. under C:\Windows\System32 on my PC). However, you may see several question marks and errors. It turns out these are just due to some limitations in Dependency Walker and not an actual issue. See Dependency Walker: missing dlls
I'm trying to make some modifications to the text-buffer package for Atom. I checked out text-buffer, made the modifications, and according to flight manual I do:
$ npm install
$ npm link
$ apm rebuild
After solving many problems with install and rebuild this finally works. Now I go to the folder with Atom checked out and do:
$ npm link text-buffer
$ script\build
This completes successfully. Now I go to the directory with the built version of Atom, and running Atom fails with the following visible in console:
Module version mismatch. Expected 47, got 46.
Error: Module version mismatch. Expected 47, got 46.
at Error (native)
at process.module.(anonymous function) [as dlopen] (ATOM_SHELL_ASAR.js:159:20)
at Object.Module._extensions..node (module.js:450:18)
at Object.module.(anonymous function) [as .node] (ATOM_SHELL_ASAR.js:170:18)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (D:\temp\atom-dev\resources\app.asar\node_modules\nslog\lib\nslog.js:5:11)
at Object.<anonymous> (D:\temp\atom-dev\resources\app.asar\node_modules\nslog\lib\nslog.js:15:4)
Searching online suggested to do
npm rebuild
I did this inside my text-buffer repository, then repeated the steps above with the same error in Atom. I also called npm update from both repositories. Calling npm rebuild from my Atom repository causes this failure.
keyboard-layout-observer-windows.cc
..\src\keyboard-layout-observer-windows.cc(92): error C2220: warning treated as error - no 'object' file generated [C:\
Users\Tomek\Documents\GitHub\atom\node_modules\atom-keymap\node_modules\keyboard-layout\build\keyboard-layout-observer.
vcxproj]
I did build Atom before linking the changed package and that worked fine. What is actually causing the mismatch and how do I fix it? Do I need to call npm rebuild from the Atom directory to fix this?