I'm using gradle node plugin for my project and when I run the nodeSetup task it tries to install the node dist from https://nodejs.org/dist/v12.6.0/node-v12.6.0-darwin-x86_64.tar.gz which I know does not exists. The correct URL should be https://nodejs.org/dist/v12.6.0/node-v12.6.0-darwin-x64.tar.gz I'm not sure why its adding x86_64 instead of x64 and I was wondering if there is any way to directly specify the complete dist URL for gradle node plugin.
Here is my node config inside my build.gradle
node {
version = '12.6.0'
npmVersion = '6.0.0'
yarnVersion = '1.13.0'
download = true
workDir = file("${buildDepsDir}/nodejs")
npmWorkDir = file("${buildDepsDir}/npm")
yarnWorkDir = file("${buildDepsDir}/yarn")
nodeModulesDir = file("${project.projectDir}")
}
It sounds like you may be using an old version of the plugin, this exact issue has been fixed in 3.2.1
Related
Using Win10 Pro / VS2015 with a 'website' project (not asp.net, basic website)
When attempt to save/reload gulpfile.js I receive the error message (from Task Runner Explorer/output)
SyntaxError: Use of const in strict mode.
In the present case it is choking on 'gulp-changed'
I have looked through the answers and comments available:
SyntaxError: Use of const in strict mode
SyntaxError: Use of const in strict mode?
I have updated my version of node to the latest: 6.10.30
I have cleaned the cache (npm cache clean -f)
I have used 'which node' to determine that node is pointing to the installation of the latest install.
"n" does not want to install on Windows (?)
In my case the environment path, $(PATH) already include the global install of node but I needed to move it ahead of the $(DevEnvDir) paths so that it would get priority.
(added after correct answer provided, thanks #baao)
VS seems to install (and then use) an old version of node, which is why the task runner is breaking the build.
Go to Tools > Options > Projects and Solutions > External Web Tools and add the correct path to your node version (find the path with which node).
Credits to: https://github.com/sindresorhus/gulp-imagemin/issues/178#issuecomment-218131138
I have reinstalled my web app in a new server without changing anything and now I receive this error:
TypeError: QRCode.drawBitArray is not a function
why? i haven't change my code....
this is the library : https://github.com/simwood/node-qrcode
and yess, i have install all the dependencies.
alternatively, do I recommend libraries that return an array with the length of the line?
sorry for bad english(:
drawBitArray has been removed in the last version of qrcode.
The official repo seems to be here and the last version with the function is 0.7.1.
In the last version (at this time 1.4.4) you can obtain the array of bits and the size returned by drawBitArray this way:
const myQrCode = qrcode.create("myContent")
const bits = new Uint8Array(myQrCode.modules.data)
const QrLineSize = myQrCode.modules.size
run this npm install --save node-qrcode
if that doesnt work try deleting node_modules folder and running that command again.
also check the version of node-qrcode that are installed in your package.json file. make sure theyre consistant with eachother
I'm building an Electron application starting from the electron-webpack boilerplate.
I found this node module #ffmpeg-installer/ffmpeg which installs a compatible precompiled binary into the /node_modules directory then makes the path of that executable accessible through.
const ffmpegPath = require('#ffmpeg-installer/ffmpeg').path
This works fine during development, but when I build the distributable and run it I get an error when attempting to spawn a child process with that path. Presumably, because the path does not point at the binary.
The path is set to the following when running the distributable.
/Users/me/project/dist/mac/AppName.app/Contents/Resources/app.asar/node_modules/#ffmpeg-installer/darwin-x64/ffmpeg
However, when looking in the AppName.app package contents I find the binary in the following path.
/Users/me/project/dist/mac/AppName.app/Contents/Resources/app.asar.unpacked/node_modules/#ffmpeg-installer/darwin-x64/ffmpeg
How should I include binary dependencies in an Electron application using electron-webpack and electron-builder?
From here:
Install: npm i ffmpeg-static ffprobe-static
Include in your package.json:
build{
...
"asarUnpack":[
"node_modules/ffmpeg-static/bin/${os}/${arch}/ffmpeg",
"node_modules/ffmpeg-static/index.js",
"node_modules/ffmpeg-static/package.json"
]
}
Set path in your JS:
const ffmpeg = require('fluent-ffmpeg');
//Get the paths to the packaged versions of the binaries we want to use
const ffmpegPath = require('ffmpeg-static').replace(
'app.asar',
'app.asar.unpacked'
);
const ffprobePath = require('ffprobe-static').path.replace(
'app.asar',
'app.asar.unpacked'
);
//tell the ffmpeg package where it can find the needed binaries.
ffmpeg.setFfmpegPath(ffmpegPath);
ffmpeg.setFfprobePath(ffprobePath);
It's likely because electron will bundle the app in an asar archive (something like a zip/tar/jar). Hence, the path to the executable can't be resolved. Try passing asar: false to electron-builder (in electron-builder.json).
I would like to know if its possible to get the git version for my package.json
What i want to achieve is that i don't need to bump the version manually.
There is something like that in Java with gradle f.e.
https://github.com/palantir/gradle-git-version
It is using git describe to get the latest tag of the git repo and if it contains new commits/changes the repo is marked as dirty. On the dirty check it automatically returns the next development version for gradle.
I didn't find anything like that for gulp
Yes.
Check this npm module https://www.npmjs.com/package/git-version-json
You can use gulp-replace and git-version-json
use git-version-json to generate the json variable.
use gulp-replace to replace the version
As below:
var gulp = require('gulp');
var replace = require('gulp-replace');
var GitVersionJson = require('git-version-json');
// automatic use git-rev in version field of package.json
gulp.task('npm-git-rev', [GitVersionJson.task], ()=>{
return gulp.src('package.json')
.pipe(replace(/(\"version\"\s*:\s*\"\d+\.\d+\.)(\d+)(\")/,
"$1" + GitVersionJson.gitVer.rev + "$3"))
.pipe(gulp.dest('.'))
});
run it with gulp npm-git-rev
I'm building a node webkit app and want to gulp run it. However every time gulp grabs the 'latest' alpha build (v0.13.0) and I need it to grab v0.12.2 how can I tell it to do this??
The full error is:
[11:14:45] Starting 'run'... Latest Version: v0.13.0 Using v0.13.0 Create cache folder in
/Users/Scot/chat/node_modules/node-webkit-builder/cache/0.13.0
Downloading: http://dl.nwjs.io/v0.13.0/nwjs-v0.13.0-osx-x64.zip
ERROR: The version 0.13.0 does not have a corresponding build posted
at http://dl.node-webkit.org/. Please choose a version from that list.
Unable to download nodewebkit. [11:14:47] Finished 'run' after 1.75 s
You can see here: https://github.com/mllrsohn/node-webkit-builder/blob/master/example/Gulpfile.js
var nw = new NwBuilder({
version: '0.12.2',
files: './nwapp/**',
macIcns: './icons/icon.icns',
macPlist: {mac_bundle_id: 'myPkg'},
platforms: ['win32', 'win64', 'osx32', 'osx64']
});