We have upgrade gradle from 4.8 to 7.3 after that nodeSetup build gets fail with below error.
Could not find method layout() for arguments [pattern, com.moowork.gradle.node.task.SetupTask$_addRepository_closure5$_closure7#25995910] on object of type org.gradle.api.internal.artifacts.repositories.DefaultIvyArtifactRepository.
Below are code snippet of build.gradle.
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.moowork.gradle:gradle-node-plugin:1.3.1"
classpath "io.spring.gradle:dependency-management-plugin:1.0.11.RELEASE"
}
}
apply plugin: "com.moowork.node"
apply plugin: "io.spring.dependency-management"
node {
version = "16.13.12"
npmVersion = "6.12.0"
download = true
nodeModulesDir = file("/XXX")
}
Cause:
There is a breaking change in gradle 6.8 which is you can checkout here:
https://docs.gradle.org/current/userguide/upgrading_version_6.html#configuring_the_layout_of_an_ivy_repository
"The 'layout' method taking a configuration block has been removed and
is replaced by 'patternLayout'
Your plugin "com.moowork.gradle:gradle-node-plugin:1.3.1" is using that method which not upgraded in this library.
Solution:
You can use this gradle-node-plugin instead of "com.moowork.gradle:gradle-node-plugin:1.3.1"
Installation:
https://github.com/node-gradle/gradle-node-plugin/blob/master/docs/installation.md
Installing the node-related plugins can be done in multiple ways. The easiest is to use the plugins-closure in your build.gradle file:
plugins {
id "com.github.node-gradle.node" version "3.1.1"
}
You can also install the plugins by using the traditional Gradle way:
buildscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath "com.github.node-gradle:gradle-node-plugin:3.1.1"
}
}
apply plugin: 'com.github.node-gradle.node'
Assume that package localization#2.0.0 requires peer dependency of package library of minimal version 1.1.0 and maximal version1.5.4. With JavaScript, the logical expression will be:
libraryVersion >= 1.1.0 && libraryVersion <= 1.5.4
But how to express same condition in peerDependencies (and other types of dependencies) filed of package.json? I did not find the logic operator and in semver documentation.
{
"peerDependencies": {
"library": ">=1.2.7 "
}
}
This isn't possible. You can do something like "library": "1.x" but that's it.
I would like to compile grpc with newer openssl( >= 1.1.0 ) in nodejs project, but I have no idea how to get along with it.
Here is the package.json in the whole project.
{
"name": "fabcar",
"version": "1.0.0",
"description": "FabCar application implemented in JavaScript",
"engines": {
"node": ">=8",
"npm": ">=5"
},
"scripts": {
"lint": "eslint .",
"pretest": "npm run lint",
"test": "nyc mocha --recursive"
},
"engineStrict": true,
"author": "Hyperledger",
"license": "Apache-2.0",
"dependencies": {
"fabric-ca-client": "~1.4.0",
"fabric-network": "~1.4.0"
},
"devDependencies": {
"chai": "^4.2.0",
"eslint": "^5.9.0",
"mocha": "^5.2.0",
"nyc": "^13.1.0",
"sinon": "^7.1.1",
"sinon-chai": "^3.3.0"
},
"nyc": {
"exclude": [
"coverage/**",
"test/**"
],
"reporter": [
"text-summary",
"html"
],
"all": true,
"check-coverage": true,
"statements": 100,
"branches": 100,
"functions": 100,
"lines": 100
}
}
And in this project, the fabrc-ca-client, fabric-network will uses grpc.
here is some env:
$ npm version
{ npm: '6.4.1',
ares: '1.10.1-DEV',
cldr: '32.0',
http_parser: '2.8.0',
icu: '60.1',
modules: '57',
napi: '4',
nghttp2: '1.33.0',
node: '8.16.0',
openssl: '1.0.2r',
tz: '2017c',
unicode: '10.0',
uv: '1.23.2',
v8: '6.2.414.77',
zlib: '1.2.11' }
$ node -v
v8.16.0
Please help on compile grpc in nodejs with newer openssl(>=1.1.0).
I am using Ubuntu 18.04 and only need to building on linux.
Any advice would be greatful!
Thanks!
There are three major obstacles to building grpc with a different OpenSSL library. First, Node.js already exports the OpenSSL symbols for native modules to dynamically link against. This means that you won't be able to dynamically link your own OpenSSL library; it would cause symbol collision errors. You would need to statically link the library, and be sure to hide the symbols. This can require either explicitly linking the relevant .a file if you already have one, or compiling the library from source as part of the build process. This is not an issue when building for Windows or for Electron, so you should be able to get away with dynamically linking in those cases
Second, the OpenSSL headers are included in the Node headers that are included by default when building native addons like grpc. If you want to use your own version of OpenSSL, you will need to use your own headers for that version instead of those headers. We currently need to do this to use BoringSSL in the Windows library, so we have node-gyp download the headers, then we go in and delete the openssl directory, then build the library for real. You will likely need to do that in this situation too. This isn't an issue on Electron.
Third, grpc is written to use a variety of specific APIs in OpenSSL. Depending on which other version you want to use, there is a chance that it will not be compatible. I am not sure what the usable version range is here, but this is something to keep in mind.
If you can solve all of these problems, you will need to make some significant edits to grpc's binding.gyp file to accomplish this. If you are building OpenSSL from source, the existing boringssl target should be a good template. You can add a similar target for openssl and then have the grpc target depend on it. If you already have a .a file, you should be able to add a linker flag to the grpc target to link it. In either case, make sure to remove references to other OpenSSL headers in various parts of the file.
first, to say, I am new to Angular.
I am trying to use the crypto-js module to encrypt and decrypt a string passed to a Service. The service is injected to whoever uses it. My Problem is, apparently I can not Import a reference to this module.
My current set up is:
Angular CLI: 6.0.8
Node: 9.7.1
OS: win32 x64
Angular: 6.1.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
#angular-devkit/architect 0.6.8
#angular-devkit/build-angular 0.6.8
#angular-devkit/build-optimizer 0.6.8
#angular-devkit/core 0.6.8
#angular-devkit/schematics 0.6.8
#angular/cli 6.0.8
#ngtools/webpack 6.0.8
#schematics/angular 0.6.8
#schematics/update 0.6.8
rxjs 6.3.2
typescript 2.7.2
webpack 4.8.3
The crypto-js package was installed by npm and the folder is properly located in the node_modules folder as you can see in the screenshot.
My Service (It will not contain any sensitive information in the code in future, just for testing) looks like this:
import {Injectable, OnDestroy} from "#angular/core";
// will be used in future
import { CookieService } from "ngx-cookie-service";
const algorithm = 'aes-256-ctr';
// Todo generate password
const password = '1xap0957/ara=Xv9';
#Injectable()
export class Abc_tService implements OnDestroy {
Enc(text) {
// Encrypt
var en = this.encrypt(text);
console.log(en);
console.log(this.decrypt(en));
}
private encrypt(text: string): string {
return text;
}
private decrypt(text): string {
return text;
}
ngOnDestroy() {
}
}
The Enc(text) Method is used for testing. Now my problem is, that I can't import or access the crypto-js module.
When I try to import it, I also can't access it. Now my imported reference seems to reference my own class:
My Goal is to use the crypto-js module in my service. What am I missing?
Thanks to Aluan Haddads comment on my question. The Solution simply was, I had to install the type. I did this using npm with the command:
npm install --save #types/crypto-js
It looks like the AndroidStudio 2.1 editor highlights the header file from a native module red as though it is missing. It seems to build and run with no issues though. Anyone facing the same issue? (See attached images below)
Also the editor suggests that I include Addition.h using the long relative path. Adding the header file location with cppFlags does not seem to fix this issue.
app build.gradle
apply plugin: 'com.android.model.application'
model {
android {
.......
ndk{
moduleName = 'native'
}
sources {
main {
jni {
dependencies {
project ':Addition' linkage 'static'
}
}
}
}
}
}
Addition module build.gradle
apply plugin: 'com.android.model.native'
model {
android {
........
ndk {
moduleName = 'addition'
}
sources {
main {
jni {
exportedHeaders{
srcDir "src"
}
source {
srcDir "src"
}
}
}
}
}
}
Steps to Reproduce: https://github.com/noridge/StudioClintBug
Studio Build: 2.1.1
Version of Gradle Plugin: experimental 0.7.0 and 2.1.0
Version of Gradle: 2.10
OS: MacOSX El Capitan 10.11.4
Filed a bug with Google. They seem to have fixed it in 2.2
https://code.google.com/p/android/issues/detail?id=209865