I just started using JEST, I can't figure out what's wrong.
I've tried reinstalling all packages and clearing the cache.
● Test suite failed to run
The module '/Users/dan_kos/Documents/Work/Authorization project/admin_service/server/node_modules/nodegit/build/Release/nodegit.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 102. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at Runtime._loadModule (node_modules/jest-runtime/build/index.js:893:29)
at Object.<anonymous> (node_modules/nodegit/dist/nodegit.js:12:12)
Jest config:
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"transform": {
"node_modules/variables/.+\\.(j|t)sx?$": "ts-jest"
},
"transformIgnorePatterns": [
"node_modules/(?!variables/.*)"
]
}```
It was an absolutely stupid mistake, I forgot to change the version of node.js in the WebStrom settings and it ran everything in version 17 instead of 14
Related
Getting this error while running Task Runner Explorer for gulp.js on Visual Studio 2022 Community Edition
Failed to run "C:/Users/......./Gulpfile.js"...
cmd.exe /c gulp --tasks-simple
ReferenceError: primordials is not defined
What I have already tried
It was mentioned in How to fix "ReferenceError: primordials is not defined" in Node.js to downgrade node or upgrade Gulp, but my colleague is having the same version and its working for him.
Tried creating npm-shrinkwrap.json file as well which contains following content
{
"dependencies": {
"graceful-fs": {
"version": "4.2.2"
}
}
}
Added an overrides section in the package.json file:
{
// current package.json
"overrides": {
"graceful-fs": "^4.2.10"
}
}
Current version of node, npm and gulp is
node --version
v16.16.0
npm --version
8.11.0
gulp --version
CLI version: 2.3.0
Local version: 3.9.1
Let me know if there is anything I am missing or need to do
Some context
Every time VS Code is released built on a new version of Node, the VS Code Arduino extension breaks until a new version is released.
Having cloned the Arduino extension git repo I uninstalled it as an extension and ran it in the debugger. This worked and now I have specific intel, if only I knew how to act on it. This is the message:
[Warn] no library available after trying files native_loader.js
undefined
Array[3]
0
"d:/vscode-arduino/out/node_modules/node-usb-native/lib/native/detector_darwin_7.1.11_x64.node"
1
"d:/vscode-arduino/out/node_modules/node-usb-native/lib/native/detector_Ubuntu14.04_7.1.11_x64.node"
2
"d:/vscode-arduino/out/node_modules/node-usb-native/lib/native/detector_win32_7.1.11_x64.node"
rejected promise not handled within 1 second: Error: The module '\\?\d:\vscode-arduino\out\node_modules\usb-detection\build\Release\detection.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 80. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
extensionHostProcess.js
stack trace: Error: The module '\\?\d:\vscode-arduino\out\node_modules\usb-detection\build\Release\detection.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 80. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
The last of these files (the Windows x64 one) is indeed present on the expected path so "no library available" doesn't mean it can't find the file. This agrees with the end of the message which reports that no suitable version can be found.
The end of this message suggests npm rebuild or npm i so I tried those to no avail.
Rummaging in package.json revealed
"scripts": {
"vscode:prepublish": "gulp build --mode=production",
"postinstall": "cd ./src/views && npm install && node ../../node_modules/node-usb-native/scripts/rebuild-serialport.js",
"test": "gulp test"
},
"extensionDependencies": [
"ms-vscode.cpptools"
],
"devDependencies": {
"#types/compare-versions": "^3.0.0",
...
"webpack": "^4.44.1"
},
"dependencies": {
...
"node-usb-native": "0.0.13",
...
}
The dependency on node-usb-native is behind the latest (0.0.15). Changing this and running npm i triggers the post-install task to rebuild-serialport.js which appears to succeed, but I get the same error at runtime.
The question
How do I resolve this?
What exactly needs rebuilding? usb-detection isn't listed in the dependencies (or the devDependencies) but if I'm not mistaken node-usb-native depends on it.
How do I go about this such that the code complaining about
versions sees the freshly minted bits?
When I use nodegit in electron, I got the error when I start the app:
App threw an error during load
Error: A dynamic link library (DLL) initialization routine failed.
\?\D:\Electron\hello\node_modules\nodegit\build\Release\nodegit.node
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:740:18)
...
I can use nodegit in nodejs successfully, but failed in electron.
Even I added .npmrc file with content below, it's still faield.
runtime = electron
target = 1.2.8
target_arch = x64
disturl = https://atom.io/download/atom-shell
Does anyyone know how to fix it in electron?
My environment is windows 10 x64 with vs 2017, node 10.13, electron 3.010
I had the same problem with another node package using electron 3.0.6 and eventually got it working.
Try these:
Make sure the packages are listed under the dependencies and not devDependencies in the package.json
Add this "electron-rebuild --force node-gyp rebuild --target=3.0.6 --arch=x64" to postinstall under the scripts section. I ended up with this in my packages.json (my DLL error was for "printer")
{
"name": "myproject",
"version": "1.0.0",
"main": "main.js",
"scripts": {
"postinstall": "electron-rebuild --force node-gyp rebuild --target=3.0.6 --arch=x64",
"start": "electron ."
},
"dependencies": {
"#types/node": "^10.12.18",
"electron-rebuild": "1.8.2",
"electron": "3.0.6",
"printer": "0.2.2"
},
"devDependencies": {
...
}
}
See here for more info
Hope this helps someone
From this link:
The most common issue though is that the component was not properly installed, so that some of its dependencies are not available.
First confirm if global node version matches with the project one. Some projects require specific version hence first delete other node and install required node version and project dependencies. Try below solutions to solve the errors as same worked for me
Clean up node modules [ https://medium.com/#mariokandut/how-to-clean-up-node-modules-5aed676156db ] and rebuild the project. It rebuilds node_modules folder
Since it is an electron app try yarn electron-rebuild. For more info on yarn refer " https://www.digitalocean.com/community/tutorials/how-to-install-and-use-the-yarn-package-manager-for-node-js "
If electron rebuild fails check if "Visual C++ Build Environment" are installed. Refer https://stackoverflow.com/a/61252536/9558119 for same.
Rerun electron rebuild and then run build as per your project
I have a .npmrc file with:
runtime = electron
target = 1.7.9
target_arch = x64
disturl = https://atom.io/download/atom-shell
build_from_source = true
And apackage.json file with:
"scripts": {
"start": "electron .",
"test": "mocha"
}
Following a npm install, when I run my node.js script using npm start, everything works as expected. However, when I use npm test I'm running into an error:
Uncaught LevelUPError: Failed to require LevelDOWN (The module '/Users/_me_/_project_/node_modules/leveldown/build/Release/leveldown.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 54. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using 'npm rebuild' or 'npm install').). Try 'npm install leveldown' if it's missing
My test.js file uses a small subset of modules that do not require electron.
I've tried running npm rebuild, npm install, and npm install leveldown after clearing the npm_modules directory, but the error persists.
Any idea why I'm seeing these errors or how to correct this issue?
Edit: I was able to switch mocha out with electron-mocha and bypass the error.
npm cache clean
npm install
electron-rebuild(need npm install electron-rebuild)
i ues these methods to solve the problem
Recently we restarted our server:
Linux version 4.4.4-200.fc22.x86_64 (mockbuild#bkernel02.phx2.fedoraproject.org) (gcc version 5.3.1 20151207 (Red Hat 5.3.1-2) (GCC) ) #1 SMP Fri Mar 4 20:06:29 UTC 2016
When i try to run my tests with webdriverio, for my meteor app:
//scripts:{"wdio-test": "wdio tests/config/wdio.mocha.conf.js"}
meteor npm run wdio-tests
I get this Error:
ERROR: Module meteor can't get loaded. Are you sure you have installed it?
Note: if you've installed WebdriverIO globally you need to install these external modules globally too!
chrome
at MochaAdapter.load (node_modules/wdio-mocha-framework/build/adapter.js:473:23)
at wdio-mocha-framework/build/adapter.js:321:28
at Array.forEach (native)
at MochaAdapter.requireExternalModules (node_modules/wdio-mocha-framework/build/adapter.js:313:21)
at MochaAdapter.options (node_modules/wdio-mocha-framework/build/adapter.js:139:18)
at Suite.<anonymous> (node_modules/wdio-mocha-framework/build/adapter.js:171:43)
at emitThree (events.js:102:20)
at Suite.emit (events.js:175:7)
at node_modules/mocha/lib/mocha.js:230:11
at Array.forEach (native)
These are my Versions:
meteor --version
Meteor 1.5.2.2
meteor node --version
v4.8.4
meteor npm --version
4.6.1
node --version
v6.11.2
npm --version
3.10.10
And the packages:
"mocha": "^3.5.0",
"mocha-mongoose": "^1.2.0",
"mocha-reporter": "0.0.3",
"mockery": "^2.1.0",
"mongo-mock": "^2.5.0",
"mongoose": "^4.12.0",
"selenium-webdriver": "^3.0.0-beta-2",
"wdio-mocha-framework": "^0.5.11",
"webdriverio": "^4.8.0",
We recently did an upgrade from Meteor 1.3.5 to 1.5.2.2, but there was not a problem with the webdriver tests. Since the restart however i am getting the error mentioned above.
I have also not installed any packages globally.
Anyone knows how i can fix this?
I found out i had this option inside my wdio-mocha.conf:
mochaOpts: {
ui: 'bdd',
compilers: ['js:babel-register'],
require: ['babel-polyfill', 'meteor'],
},
removing the meteor tag solved the problem.
I will let this question open for a while, maybe someone has to add something.