Node error when I run npm with laravel breeze - node.js

I have this error when I run npm run dev or npm run watch and I didn't find what is the mess. It's happens in a all fresh Laravel 8 app.
It looks like happen when I use the developement command
ERROR in ./resources/css/app.css
Module build failed (from ./node_modules/css-loader/index.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/src/index.js):
TypeError: [(...variantsValue),(...extensions)].flat is not a function
at /var/www/html/smart_recipe/node_modules/tailwindcss/lib/util/resolveConfig.js:219:73
at baseMergeDeep (/var/www/html/smart_recipe/node_modules/lodash/_baseMergeDeep.js:42:7)
at /var/www/html/smart_recipe/node_modules/lodash/_baseMerge.js:27:7
at /var/www/html/smart_recipe/node_modules/lodash/_createBaseFor.js:17:11
at baseMerge (/var/www/html/smart_recipe/node_modules/lodash/_baseMerge.js:24:3)
at /var/www/html/smart_recipe/node_modules/lodash/mergeWith.js:36:3
at /var/www/html/smart_recipe/node_modules/lodash/_createAssigner.js:30:9
at apply (/var/www/html/smart_recipe/node_modules/lodash/_apply.js:15:25)
at /var/www/html/smart_recipe/node_modules/lodash/_overRest.js:32:12
at mergeVariantExtensions (/var/www/html/smart_recipe/node_modules/tailwindcss/lib/util/resolveConfig.js:218:33)
at resolveVariants (/var/www/html/smart_recipe/node_modules/tailwindcss/lib/util/resolveConfig.js:235:10)
at resolveConfig (/var/www/html/smart_recipe/node_modules/tailwindcss/lib/util/resolveConfig.js:271:15)
at /var/www/html/smart_recipe/node_modules/tailwindcss/lib/index.js:77:37
at /var/www/html/smart_recipe/node_modules/tailwindcss/lib/processTailwindFeatures.js:52:20
at LazyResult.run (/var/www/html/smart_recipe/node_modules/postcss/lib/lazy-result.js:288:14)
at LazyResult.asyncTick (/var/www/html/smart_recipe/node_modules/postcss/lib/lazy-result.js:212:26)
at LazyResult.asyncTick (/var/www/html/smart_recipe/node_modules/postcss/lib/lazy-result.js:225:14)
at /var/www/html/smart_recipe/node_modules/postcss/lib/lazy-result.js:217:17
at runLoaders (/var/www/html/smart_recipe/node_modules/webpack/lib/NormalModule.js:316:20)
at /var/www/html/smart_recipe/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /var/www/html/smart_recipe/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/var/www/html/smart_recipe/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Promise.resolve.then.then.catch (/var/www/html/smart_recipe/node_modules/postcss-loader/src/index.js:208:9)
# ./resources/css/app.css

I came across same issue and spent 5 hours on finding solution but could not.
After searching alot, I came across this
"Tailwind CSS v2.0 no longer supports Node.js 8 or 10. To build your CSS you'll need to ensure you are running Node.js 12.13.0 or higher in both your local and CI environments."
at https://tailwindcss.com/docs/upgrading-to-v2
So I realized that issue was in my Node version which was 10.x so
I uninstalled Node from my windows machine and downloaded LTS version (14.x).
So consider updating your Node version, it will solve the issue as it did work for me.
There is possibility that old node versions don't have that flat function that Tailwind CSS 2 has implemented and that's throwing error.

I Had the exact same issue after installing Breeze... Unfortunately the npm error message gives no clue of what is really going on !
Thanks to #DaniyalGondal I found out that my node version was raising the error because of tailwind V2 requirements (https://tailwindcss.com/docs/upgrading-to-v2) that comes with Breeze... So I did upgrade my node version using : sudo n latest under ubuntu20
Don't forget to restart your terminal after upgrading and check that your node is correctly upgraded using : node --version
If the node version is above 12.13.0, now npm run watch or npm run dev should work fine !

Related

Node.js native addon module (tfjs_binding.node) can not be found

I am writing an Electron application and would like to integrate my AI. For this I have installed #tensorflow/tfjs-node version 3.0.0. When I want to execute my code (const tf = require("#tensorflow/tfjs-node");) the following error message appears in the console:
Uncaught (in promise) Error: The Node.js native addon module (tfjs_binding.node) can not be found at path: C:\...\simplePhishNew\node_modules\#tensorflow\tfjs-node\lib\napi-v6\tfjs_binding.node.
Please run command 'npm rebuild #tensorflow/tfjs-node build-addon-from-source' to rebuild the native addon module.
The Console is tell me:
node-pre-gyp info This Node instance does not support builds for N-API version 7
The Solution,
Please run command 'npm rebuild #tensorflow/tfjs-node build-addon-from-source' to rebuild the native addon module.
doesnt work and is showing the following error message.
CPU-windows-3.0.0.zip
* Building TensorFlow Node.js bindings
symlink ./lib/napi-v7 failed: null
#tensorflow/tfjs-node#3.0.0 C:\...\node_modules\#tensorflow\tfjs-node
Thanks for the effort
I did it guys...
Step 1:
Stop crying
Step 2:
Call the boss again and take back the notice of termination
Step 3:
Electron need a specific node version
https://github.com/electron/releases
For example Electron v. 11.3.0 needs node 12.18.3
Step 4:
Ask yourself why you actually got the job

How to fix 'ERROR ON PAGE: ReferenceError: Can't find variable: require' - NodeJS with Sinon.js

I have problem with test cases running. actually I upgrade node dependency from old version to new version also node version v6 to v10, Before update npm module my code was working fine. But I do not known what issue happen now.
Please help me out that..!

Error: Module version mismatch. Expected 47, got 48

I'm writing a Visual Studio Code extension which uses a native node.js module. When I try to debug this extension in vscode I get the error message from above, when loading the native module (when commenting out the require() call no error comes up). It tried quite a few steps to overcome + test this:
npm uninstall native-module followed by a npm install native-module --save-dev in my vscode extension folder, this compiled the native module completely and without problems.
Completely cleaned my node_modules folder in the extension and did again the npm install --save-dev.
Installed node.js again, both LTS and current. With LTS the error message changes to: expected 47, got 46.
Installed latest vscode (August recovery build)
Launched a node session in my vscode extension folder and loaded my native module. This works nicely.
Read the various questions and comments here on SO. They mostly recommend what I described above.
Still, I cannot get vscode to accept my native module. What can I do? From the above steps it appears as if vscode has been built with a node.js version between current and LTS. Can I force my native module somehow to use a specific version?
Btw. what do those numbers 48, 47, 46 etc. actually mean? The node.js version is of course in the typical form: major.minor.build and nothing of that matches the above version numbers.
Update:
ok, I found what those numbers mean: https://nodejs.org/en/download/releases/
Once you know what those numbers in the error message mean it's easy to solve the issue. Simply install the node.js version that is expected. In my case it's node.js 5.12.0.
Remove node_modules folder
Run npm update
Then;
Run npm install

Nodejs (Sync) cannot find fibers binaries

I've seen similar questions but no real solution that worked for me yet (most users just reinstall fibers or meteor (I'm not using meteor)).
I've added the nodejs module Sync to my nodejs 0.12.6 project. It's dependency is the Fibers module that got installed automatically with Sync. Now I wanted to load Sync via require, but it fails with the message
... /win32-x64-v8-4.3/fibers.node not found
And it's correct: In sync/node_modules/fibers/bin/ is no directory named win32-x64-v8-4.3, only win32-x64-v8-4.2 and renaming didn't solve the problem (would have been too easy)... 🙈
How can I solve this problem? How can this happen?
What is the meaning of the last number (4.3)? I guess it's windows, 64bit, Javascript v8 engine, and then? Fibers version?
Any ideas or hints?
Update:
I tried to updgrade node to 0.12.6, but nothing changed.
I found out what the 4.3 is about, it's the v8 version. Well, when running my application with electron, it is v8: '4.3.61.21'. When checking the version with node, it is 3.28. So it's maybe electrons "fault"?
Update #2:
Okay i found out that electron is based on io.js and not node. That explains the different v8 versions. But still no solution. When installing fibers with latest io.js (2.3.3), it tests the 4.2 binary, but electron requires 4.3 :(
Update #3:
Even with the same io.js version 2.3.1 as electron, it does only install the 4.2 binary.
Update #4:
Now, I've tried all three ways described at http://electron.atom.io/docs/v0.27.0/tutorial/using-native-node-modules/ (with electron version 0.29.1) - still no solution. There aren't any binaries for v8-4.3, still only the v8-4.2 ones. :(
Solution:
See my answer below. :)
At the end, i had to compile fibers on my own. As described in Update #4, i've tried it before. But node-gyp always failed and i didn't notice that i have to link to the new binary file on my own...
cd ~/my-project-root/
npm install sync
cd ./node_modules/sync/node_modules/fibers
node-gyp configure
HOME=~/.electron-gyp node-gyp rebuild --target=0.29.1 --arch=x64 --dist-url=https://atom.io/download/atom-shell
Then i've created the missing directory and moved the new binary there:
mkdir bin/win32-x64-v8-4.3
mv build/Release/fibers.node bin/win32-x64-v8-4.3/fibers.node
Now Sync works like a charm.
You need to use the electron-rebuild tool to rebuild your native module against the version of Electron you're using

run casperjs from node app folder

Ok, let's make it simple :
I migrated my working node.js app to a new server today. The app spawns casperjs processes to do stuff.
Problem :
It doesn't run anymore
Why?
output casperjs --version from any folder but the one where my node app is installed :
root#xxxxx:/var# casperjs --version
1.1.0-beta3
now from the folder where my node app is installed :
root#xxxxx:/var/nodeapp# casperjs --version
Error: Cannot find module 'sys'
phantomjs://bootstrap.js:289
phantomjs://bootstrap.js:254 in require
/var/nodeapp/node_modules/system/engines/node/system.js:8
/var/nodeapp/node_modules/system/engines/node/system.js:45
1.1.0-beta3
Isn't that weird? :D Thanks for any insights
Edit : Tried uninstalling casper, then reinstalling from npm (I used github before). Same error.
-DEV was the previous version (see https://github.com/n1k0/casperjs/commit/9f510ed68010b3fadc8842115a12d2712213779d#diff-b9cfc7f2cdf78a7f4b91a753d10865a2 ), up to about 4 months ago. So 1.1-beta2 should give you that.
You could also try getting the latest git version; you can see a list of changes since 1.1.0-beta3 here (I don't spot your problem though): https://github.com/n1k0/casperjs/compare/1.1-beta3...master
By the way, are you running the same PhantomJS version on each of the working and non-working server? (Actually, what I would do next is upgrade your other server to first CasperJS 1.1-beta3, then the latest PhantomJS, and see if it breaks. If not, then it is not the software version but something else about the environment of the new server.)

Resources