I am creating my first react-native app. I am attempting to install the react-native command line interface as shown here. I keep getting an error when I type the command to initiate the react-native command line
OS: Windows 10
Node: 10.15.3
npm: 6.4.1
I am not behind a proxy
I have removed the http and https environment variables
Updating node and npm creates a different error as shown here
Here's the error
C:\>npm install -g react-native-cli
npm ERR! Cannot read property 'startsWith' of null
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dnort\AppData\Roaming\npm-cache\_logs\2019-04-15T09_52_28_346Z-debug.log
Here's npm get registry
C:\>npm get registry
https://registry.npmjs.org/
Here's npm config get proxy
C:\>npm config get proxy
null
Here's npm config get http-proxy
C:\>npm config get http-proxy
undefined
Here's npm config get https-proxy
C:\>npm config get https-proxy
null
Here's the log file
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'react-native-cli' ]
2 info using npm#6.4.1
3 info using node#v10.15.3
4 verbose npm-session 8e6a6f9ef2e9298d
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for react-native-cli#latest Cannot read property 'startsWith' of null
8 timing stage:rollbackFailedOptional Completed in 7ms
9 timing stage:runTopLevelLifecycles Completed in 1811ms
10 verbose stack TypeError: Cannot read property 'startsWith' of null
10 verbose stack at getProxy (C:\Program Files\nodejs\node_modules\npm\node_modules\make-fetch-happen\agent.js:164:25)
10 verbose stack at getAgent (C:\Program Files\nodejs\node_modules\npm\node_modules\make-fetch-happen\agent.js:37:19)
10 verbose stack at remoteFetch (C:\Program Files\nodejs\node_modules\npm\node_modules\make-fetch-happen\index.js:310:17)
10 verbose stack at opts.cacheManager.match.then.res (C:\Program Files\nodejs\node_modules\npm\node_modules\make-fetch-happen\index.js:172:14)
10 verbose stack at tryCatcher (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
10 verbose stack at Promise._settlePromiseFromHandler (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31)
10 verbose stack at Promise._settlePromise (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
10 verbose stack at Promise._settlePromise0 (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
10 verbose stack at Promise._settlePromises (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
10 verbose stack at Promise._fulfill (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:638:18)
10 verbose stack at Promise._resolveCallback (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:432:57)
10 verbose stack at Promise._settlePromiseFromHandler (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:524:17)
10 verbose stack at Promise._settlePromise (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
10 verbose stack at Promise._settlePromise0 (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
10 verbose stack at Promise._settlePromises (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
10 verbose stack at Promise._fulfill (C:\Program Files\nodejs\node_modules\npm\node_modules\bluebird\js\release\promise.js:638:18)
11 verbose cwd C:\
12 verbose Windows_NT 10.0.17134
13 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "react-native-cli"
14 verbose node v10.15.3
15 verbose npm v6.4.1
16 error Cannot read property 'startsWith' of null
17 verbose exit [ 1, true ]
I expect to install the react-native command line to be able to initiate react-native projects.
EDIT
Please see the npm config ls -l input below
C:\Windows\System32>npm config ls -l
; cli configs
long = true
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.4.1 node/v10.15.3 win32 x64"
; userconfig C:\Users\dnort\.npmrc
https-proxy = null
proxy = null
strict-ssl = false
; builtin config undefined
prefix = "C:\\Users\\dnort\\AppData\\Roaming\\npm"
; default values
access = null
allow-same-version = false
also = null
always-auth = false
audit = true
audit-level = "low"
auth-type = "legacy"
bin-links = true
browser = null
ca = null
cache = "C:\\Users\\dnort\\AppData\\Roaming\\npm-cache"
cache-lock-retries = 10
cache-lock-stale = 60000
cache-lock-wait = 10000
cache-max = null
cache-min = 10
cafile = undefined
cert = null
cidr = null
color = true
commit-hooks = true
depth = null
description = true
dev = false
dry-run = false
editor = "notepad.exe"
engine-strict = false
fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
force = false
git = "git"
git-tag-version = true
global = false
global-style = false
globalconfig = "C:\\Users\\dnort\\AppData\\Roaming\\npm\\etc\\npmrc"
globalignorefile = "C:\\Users\\dnort\\AppData\\Roaming\\npm\\etc\\npmignore"
group = 0
ham-it-up = false
heading = "npm"
https-proxy = null
if-present = false
ignore-prepublish = false
ignore-scripts = false
init-author-email = ""
init-author-name = ""
init-author-url = ""
init-license = "ISC"
init-module = "C:\\Users\\dnort\\.npm-init.js"
init-version = "1.0.0"
json = false
key = null
legacy-bundling = false
link = false
local-address = undefined
loglevel = "notice"
logs-max = 10
; long = false (overridden)
maxsockets = 50
message = "%s"
; metrics-registry = null (overridden)
node-options = null
node-version = "10.15.3"
noproxy = null
offline = false
onload-script = null
only = null
optional = true
otp = null
package-lock = true
package-lock-only = false
parseable = false
prefer-offline = false
prefer-online = false
; prefix = "C:\\Program Files\\nodejs" (overridden)
preid = ""
production = false
progress = true
proxy = null
read-only = false
rebuild-bundle = true
registry = "https://registry.npmjs.org/"
rollback = true
save = true
save-bundle = false
save-dev = false
save-exact = false
save-optional = false
save-prefix = "^"
save-prod = false
scope = ""
script-shell = null
scripts-prepend-node-path = "warn-only"
searchexclude = null
searchlimit = 20
searchopts = ""
searchstaleness = 900
send-metrics = false
shell = "C:\\WINDOWS\\system32\\cmd.exe"
shrinkwrap = true
sign-git-commit = false
sign-git-tag = false
sso-poll-frequency = 500
sso-type = "oauth"
; strict-ssl = true (overridden)
tag = "latest"
tag-version-prefix = "v"
timing = false
tmp = "C:\\Users\\dnort\\AppData\\Local\\Temp"
umask = 0
unicode = false
unsafe-perm = true
update-notifier = true
usage = false
user = 0
; user-agent = "npm/{npm-version} node/{node-version} {platform} {arch}" (overridden)
userconfig = "C:\\Users\\dnort\\.npmrc"
version = false
versions = false
viewer = "browser"
There was no proxy set in my configs in npm. I tried npm config get proxy it was null.
Try this link
Solution found
Uninstall current version of node.js and npm from C:\Users{your_username}\AppData\Roaming
Install an older version of node.js. You can do that here. At the time of this post I installed the LTS (Node-10.15.3 & npm-6.4.1).
Remove http & https environment variables. (type in environment variables in search bar which should take your straight to system variables).
Temporarily disable windows defender features.
Restart system
Open administrator node.js command prompt
Enter npm install -g react-native-cli
My result output is now as expected:
C:\Windows\System32>npm install -g react-native-cli
C:\Users\dnort\AppData\Roaming\npm\react-native -> C:\Users\dnort\AppData\Roaming\npm\node_modules\react-native-cli\index.js
+ react-native-cli#2.0.1
added 41 packages from 15 contributors in 19.22s
This post is a continuation of my 'How to fix 'npm does not support Node.js v11.14.0 error' on Windows?' here
Note: Most solutions to similar problems have been related to proxy issues, unsupported versions of node.js/npm, environment variables
this may occur cause of coding error, in my case this line caused error
<img class="cat-icon" v-bind:src="require('img/icon/' + icon)" style="width:25px;" />
try to run "npm run watch" to see detailed error
I ran in to similar problem which was caused by wrong ralative path when registring components by require.context
I have tried a variety of commands to delete proxy settings.
I found that the best way to clear out proxy settings is to clear out related entry in .npmrc.
In my case, I simply empty the whole file and restart cmd. And it works.
This helped me:
npm config set proxy http://username:password#host:port
npm config set https-proxy http://username:password#host:port
Related
As far as I know and as far as it's relevant, there is 2 ways to run project on Windows 10 machine, while passing variables:
NODE_ENV=production && npm run dev
npm run prod
What's going on here?.. Why first example runs smoothly, while the second - returns undefined?..
What I get with second example is currentEnv = "production", but exportableEnvName = undefined.
Any ideas how to solve it? And why it happens? Thanks!
P.S. I would prefer in not using other packages as a solution.
Code example:
config.js
const environments = {};
environments.dev = {
httpPort: 3000,
httpsPort: 3001,
}
environments.production = {
httpPort: 5000,
httpsPort: 5001,
}
const currentEnv = typeof process.env.NODE_ENV === 'string' ? process.env.NODE_ENV.toLowerCase() : '';
const exportableEnvName = typeof environments[currentEnv] === 'object' ? currentEnv : 'dev';
module.exports = environments[exportableEnvName];
package.json
{
"scripts": {
"dev": "node .",
"prod": "SET NODE_ENV=production && node ."
},
}
I am using https://www.npmjs.com/package/pdf2pic to convert my PDF to image.
const PDF2Pic = require('pdf2pic');
const pdf2pic = new PDF2Pic({
density: 100, // output pixels per inch
savename: 'untitled', // output file name
savedir: './images', // output file location
format: 'png', // output file format
size: '600x600', // output size in pixels
});
const file = "/Users/kar1/Downloads/bw.pdf"
async function recognizeFile(file) {
pdf2pic.convertBulk(file, -1).then((resolve) => {
console.log('image converter successfully!');
return resolve;
});
}
recognizeFile(file)
The error :
(node:32605) UnhandledPromiseRejectionWarning: Error: Could not execute GraphicsMagick/ImageMagick: gm "identify" "-ping" "-format" "%p" "/Users/kar1/Downloads/bw.pdf" this most likely means the gm/convert binaries can't be found
at ChildProcess.<anonymous> (/Users/kar1/Desktop/github/pdfToPic/node_modules/gm/lib/command.js:232:12)
at ChildProcess.emit (events.js:315:20)
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
I tried :
brew install imagemagick
And the issue still persists. How can I solve this?
Problem got solved by running these commands :
brew install imagemagick
brew install gs
I'm trying to use Jest to write unit tests for some JavaScript code I have. The problem is that the code file contains functions that aren't defined or imported, so when I try to import the file to test, Jest throws an error about the undefined functions. Is there a way I can get around this? Only import the functions I want to test, for example?
Here's a snippet of the file with the code that I'm trying to test:
// run any data migrations
on("sheet:opened", () => {
sheetMigration();
getAttrs(["btatow_sheet_version"], ({
btatow_sheet_version
}) => {
if (btatow_sheet_version >= 3) {
recalculateSkills();
}
});
});
...
// calculate stat values when XP amount changes
on("change:strength_xp change:body_xp change:reflex_xp change:dexterity_xp change:intelligence_xp change:will_xp change:charisma_xp change:edge_xp", calculateAbilityScore)
const calculateLinkedAttributeValue = attribute => {
if (attribute > 10) {
return Math.floor(attribute / 3);
} else {
if (attribute < 1)
return -4;
else if (attribute < 2)
return -2;
else if (attribute < 4)
return -1;
else if (attribute < 7)
return 0;
else if (attribute < 10)
return 1;
else
return 2;
}
}
...
// exports for testing
module.exports = calculateLinkedAttributeValue
Here's the code in the test file:
const calculateLinkedAttributeValue = require('./sheet-worker')
test('should calculate linked attribute value for attribute value of 0', () => {
expect(calculateLinkedAttributeValue(0)).toBe(-4)
})
I have a package.json file set up, and have brought in Jest as a dependency, like so:
{
"name": "battletech-a-time-of-war",
"version": "1.0.0",
"description": "Character sheet for Roll20 for the A Time of War TTRPG system.",
"main": "index.js",
"scripts": {
"test": "jest"
},
"author": "",
"license": "ISC",
"dependencies": {
"jest": "^26.0.1"
},
"type": "module",
"sourceType": "module"
}
Attempting to run the tests via the command line produces the following output:
C:\Stuff\Development\roll20-character-sheets\BattleTech-A-Time-of-War\development>npm run test
> battletech-a-time-of-war#1.0.0 test C:\Stuff\Development\roll20-character-sheets\BattleTech-A-Time-of-War
> jest
FAIL development/sheet-worker.test.js
● Test suite failed to run
ReferenceError: on is not defined
1 | // run any data migrations
> 2 | on("sheet:opened", () => {
| ^
3 | sheetMigration();
4 |
5 | getAttrs(["btatow_sheet_version"], ({
at Object.<anonymous> (development/sheet-worker.js:2:1)
at Object.<anonymous> (development/sheet-worker.test.js:1:39)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 1.226 s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! battletech-a-time-of-war#1.0.0 test: `jest`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the battletech-a-time-of-war#1.0.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\<User>\AppData\Roaming\npm-cache\_logs\2020-06-01T09_59_15_484Z-debug.log
EDIT: Add examples and remove link to GitHub source code.
After digging around for a while on the internet and trying different things, I was able to determine the cause of the problem. It's actually nothing to do with Jest, it's the Node require() function. I found out from this StackOverflow comment that the Node require() function basically runs all the code in the file you're importing. Hence it tries to run the undefined functions, and errors.
I have a notification system. I dont save data directly under user node.
this is my firebase data tree:
+notifall:
+-L-oplpmjınnlın:
+type:"followedyou"
+from:"{followerUid}"
+users:
+{userUid}:
+notif:
+-L-oplpmjınnlın:"true"
When i wanna show notification in recyclerview i do like this:
FirebaseDatabase.getInstance().getReference().child("notifall").child(list.get(position)).addListenerForSingleValueEvent(new ValueEventListener() {
#Override
public void onDataChange(#NonNull DataSnapshot dataSnapshot) {
if(dataSnapshot.exists()){
holder.uid=dataSnapshot.child("from").getValue().toString();
FirebaseDatabase.getInstance().getReference().child("users").child(holder.uid).child("block").child(FirebaseAuth.getInstance().getUid()).addListenerForSingleValueEvent(new ValueEventListener() {
#Override
public void onDataChange(#NonNull DataSnapshot dataSnapshot1) {
FirebaseDatabase.getInstance().getReference().child("users").child(dataSnapshot.child("from").getValue().toString()).child("about").addListenerForSingleValueEvent(new ValueEventListener() {
#Override
public void onDataChange(#NonNull DataSnapshot dataSnapshot1) {
Glide.with(context).load(dataSnapshot1.child("profilephotourl").getValue().toString()).into(holder.profilephoto);
holder.name.setText(dataSnapshot1.child("namesurname").getValue().toString());
if(dataSnapshot.child("type").getValue().toString().equals("followedyou")){
holder.desc.setText(activity.getString(R.string.followedyou));
Drawable drawable = activity.getResources().getDrawable(R.drawable.ic_newfollow);
holder.notiftype.setImageDrawable(drawable);
}
}
#Override
public void onCancelled(#NonNull DatabaseError databaseError) {
}
});
}
#Override
public void onCancelled(#NonNull DatabaseError databaseError) {
}
});
}
}
#Override
public void onCancelled(#NonNull DatabaseError databaseError) {
}
});
Now I wanna implement notifications with Firebase Cloud Messaging. I looked example code in github.
This is my code but it gives me unexpected token error when i try to deploy functions:
exports.sendFollowerNotification = functions.database.ref('/users/{followedUid}/notifs/{notifId}')
.onWrite(async (change, context) => {
const notifId = context.params.notifId;
const followedUid = context.params.followedUid;
var db = admin.database();
db.ref("notifall").child(notifId).once('value',function(snapshot){
if(snapshot.exists()){
const type = snapshot.child("type").val();
if(type==="followedyou"){
const followeruid = snapshot.child("from").val();
db.ref("users").child(followeruid).child("about").once('value',function(snapshot1){
if(snapshot1.exists()){
const name=snapshot1.child("namesurname").val();
const ppurl=snapshot1.child("profilephotourl")
db.ref("users").child(followedUid).child("token").once('value',function(snapshot3){
if(snapshot3.exists()){
const token=snapshot3.val();
var message = {
data: {
title: 'followedyou',
from: followeruid,
name: name,
image: ppurl
},
token: token
};
admin.messaging().send(message)
.then((response) => {
})
.catch((error) => {
});
}
});
}
});
}
}
});
});
How can i fix this?
Worth to mention. Im really begginner in javascript.
Edit: Mistakes
Update: Even when i use official example code from github (https://github.com/firebase/functions-samples/blob/Node-8/fcm-notifications/functions/index.js) İy still give same error.
"Unexpected token =>"
Full error log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli '/usr/bin/npm',
1 verbose cli '--prefix',
1 verbose cli '/home/ali/Documents/ShareFunction/functions',
1 verbose cli 'run',
1 verbose cli 'lint' ]
2 info using npm#6.4.1
3 info using node#v11.1.0
4 verbose run-script [ 'prelint', 'lint', 'postlint' ]
5 info lifecycle functions#~prelint: functions#
6 info lifecycle functions#~lint: functions#
7 verbose lifecycle functions#~lint: unsafe-perm in lifecycle true
8 verbose lifecycle functions#~lint: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/ali/Documents/ShareFunction/functions/node_modules/.bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin
9 verbose lifecycle functions#~lint: CWD: /home/ali/Documents/ShareFunction/functions
10 silly lifecycle functions#~lint: Args: [ '-c', 'eslint .' ]
11 silly lifecycle functions#~lint: Returned: code: 1 signal: null
12 info lifecycle functions#~lint: Failed to exec lint script
13 verbose stack Error: functions# lint: `eslint .`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:970:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:257:5)
14 verbose pkgid functions#
15 verbose cwd /home/ali/Documents/ShareFunction
16 verbose Linux 4.19.2-1-MANJARO
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "--prefix" "/home/ali/Documents/ShareFunction/functions" "run" "lint"
18 verbose node v11.1.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error functions# lint: `eslint .`
22 error Exit status 1
23 error Failed at the functions# lint script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I have the below es6 class which is in mqttModule.js.
/*jshint esversion: 6*/
import mqtt from 'mqtt';
let client;
class MqttWrapper {
constructor(mqttOptions) {
this.clientId = mqttOptions.clientId;
this.keepAlive = mqttOptions.keepAlive;
this.clean = mqttOptions.clean;
this.reconnectPeriod = mqttOptions.reconnectPeriod;
this.will = mqttOptions.lastWillMessage;
let options = {
clientId: this.clientId,
keepAlive: this.keepAlive,
clean: this.clean,
reconnectPeriod: this.reconnectPeriod,
will: this.will
};
client = mqtt.connect(url, options);
}
}
export {MqttWrapper};
and I am calling it as shown below.
import MqttWrapper from './mqttModule'
let willMessage = {
topic : 'WillMessage',
payload : 'This is the last will message',
qos : 2,
retain : 'true'
}
let mqttOptions = {
clientId : '101',
keepAlive : 10,
clean : 'false',
reconnectPeriod : '1000',
lastWillMessage : willMessage
}
let mqttWrapperObj = new MqttWrapper(mqttOptions);
When I run the gulp command it transpiles fine without any errors. But when I run it, I am getting the error saying type error. Below is the full trace.
G:\Projects\Kube2\edge-node-sdk-js-test\src\app.js:25
var mqttWrapperObj = new _mqttModule2.default(mqttOptions);
^
TypeError: _mqttModule2.default is not a function
at Object.<anonymous> (app.js:19:22)
at Module._compile (module.js:409:26)
at loader (G:\Projects\Kube2\edge-node-sdk-js-test\node_modules\babel-cli\no
de_modules\babel-register\lib\node.js:158:5)
at Object.require.extensions.(anonymous function) [as .js] (G:\Projects\Kube
2\edge-node-sdk-js-test\node_modules\babel-cli\node_modules\babel-register\lib\n
ode.js:168:7)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at G:\Projects\Kube2\edge-node-sdk-js-test\node_modules\babel-cli\lib\_babel
-node.js:171:48
at Object.<anonymous> (G:\Projects\Kube2\edge-node-sdk-js-test\node_modules\
babel-cli\lib\_babel-node.js:172:7)
at Module._compile (module.js:409:26)
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v4.4.4
npm ERR! npm v2.15.1
npm ERR! code ELIFECYCLE
npm ERR! edge-node-sdk-js-test#1.0.0 start: `babel-node --presets es2015 ./src/a
pp.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the edge-node-sdk-js-test#1.0.0 start script 'babel-node --pr
esets es2015 ./src/app.js'.
npm ERR! This is most likely a problem with the edge-node-sdk-js-test package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! babel-node --presets es2015 ./src/app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs edge-node-sdk-js-test
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls edge-node-sdk-js-test
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! G:\Projects\Kube2\edge-node-sdk-js-test\npm-debug.log
Below is my gulp file just incase.
/*jshint esversion: 6 */
const gulp = require('gulp');
const babel = require('gulp-babel');
gulp.task('es6',() => {
return gulp.src('src/app.js')
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('build'));
});
gulp.task('default',['es6'],() => {
gulp.watch('src/app.js',['es6'])
});
And below is the transpiled app.js file that gets created when I run the gulp command.
'use strict';
var _mqttModule = require('./mqttModule');
var _mqttModule2 = _interopRequireDefault(_mqttModule);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var willMessage = {
topic: 'WillMessage',
payload: 'This is the last will message',
qos: 2,
retain: 'true'
}; /*jshint esversion: 6*/
var mqttOptions = {
clientId: '101',
keepAlive: 10,
clean: 'false',
reconnectPeriod: '1000',
lastWillMessage: willMessage
};
var mqttWrapperObj = new _mqttModule2.default(mqttOptions);
I am new to ES6 and babel stuff. Please advice.