Unable to deploy cloud functions - node.js

when I deployed my functions following error came up I tried everything but I cannot solve the problem
I am writing the function for push notification i think i write the code correctly but i am not sure its correct or not
This is the error which I receive on CMD
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions# lint: `eslint .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions# lint 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\000\AppData\Roaming\npm-cache\_logs\2018-07-
20T15_42_18_516Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit
code1
This is 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 '%RESOURCE_DIR%',
1 verbose cli 'run',
1 verbose cli 'lint' ]
2 info using npm#6.1.0
3 info using node#v10.4.1
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
9 verbose lifecycle functions#~lint: CWD: C:\Users\000\fb-
functions\%RESOURCE_DIR%
10 silly lifecycle functions#~lint: Args: [ '/d /s /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> (C:\Program
Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Program
Files\nodejs\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:961:16)
13 verbose stack at Process.ChildProcess._handle.onexit
(internal/child_process.js:248:5)
14 verbose pkgid functions#
15 verbose cwd C:\Users\000\fb-functions
16 verbose Windows_NT 10.0.10586
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program
Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "--prefix"
"%RESOURCE_DIR%" "run" "lint"
18 verbose node v10.4.1
19 verbose npm v6.1.0
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 ]
This is the code which i wite in index.js
'use strict'
const functions = require('firebase-functions');
const admin = require ('firebase-admin');
admin.initializApp(functions.config().firebase);
exports.sendNotification=
functions.database.ref('/Notifications/${receiver_id}/{notification_id}')
.onWrite(event =>{
const receiver_id = event.params.receiver_id;
const notification_id = event.params.notification_id;
console.log('We have a Notifications to send to :',
receiver_id);
if (!event.data.val())
{
return console.log('A Notifications has been deleted from
the database', notification_id);
}
const deviceToken =
admin.database().ref(`/Users/${receiver_id}/device_token`)
.once('value');
return deviceToken.then(response =>
{
const token_id = result.val();
const payload =
{
notifications;
title: "Friend Request",
body: "You have a New Friend",
icon: "default"
return admin.messaging().sendToDevice(token_id, payload)
.then(response =>{
console.log('This was the notification feature.');
});
};
});
});

What version of Cloud Functions are you using? If you are on 1.0 or later, then there are a couple of things to resolve in the code. For one, the guide indicates that Realtime Database .onWrite triggers pass two parameters: change and context. Also, the path shouldn't have a "$" in it. Also, the parameters object appears to encompassing the second half of all of the code. And in that payload it says "notifications;", but I'm not sure what that's supposed to be. Seems like it should match the payload shown in the guide. There may yet be other errors I didn't catch. If it were me, I'd probably try getting a simpler function to successfully deploy, and then add to it piece by piece.
exports.sendNotification = functions.database.ref('/Notifications/{receiver_id}/{notification_id}')
.onWrite((change, context) => {
const receiver_id = context.params.receiver_id;
const notification_id = context.params.notification_id;
console.log('We have a Notifications to send to :', receiver_id);
if (!change.after.val()) {
return console.log('A Notifications has been deleted from the database', notification_id);
}
const deviceToken = admin.database().ref(`/Users/${receiver_id}/device_token`)
.once('value');
return deviceToken.then(response => {
const token_id = result.val();
const payload = {
notification: {
title: 'Friend Request',
body: 'You have a New Friend',
icon: 'default'
}
};
return admin.messaging().sendToDevice(token_id, payload)
.then(response => {
console.log('This was the notification feature.');
});
});
});

Related

Firebase Cloud Function Send Notification Error

I'm trying to send a notification using Firebase Cloud Functions to all users whenever data is added to a certain collection within Firestore.
Here is my cloud function code:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config.firebase);
exports.makeUppercase = functions.firestore.document('messages/{messageId}')
.onCreate((snap, context) => {
const value = snap.data().original;
console.log('notifying ' + value);
return Promise.all([value]).then(result => {
const value = result[0].data().value;
const payload = {
notification: {
title: "Added",
body: "Data Added"
}
};
admin.messaging().send(payload, false).then(result => {
console.log("Notification sent!");
});
});
});
When I'm trying to create this function using firebase deploy --only functions, I'm getting an error in console.
/Users/rachitgoyal/functions/index.js
35:40 error Each then() should return a value or throw promise/always-return
✖ 1 problem (1 error, 0 warnings)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions# lint: `eslint .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions# lint 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! /Users/rachitgoyal/.npm/_logs/2019-05-08T08_36_48_838Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code1
Additional logs from debug.log for reference:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli '--prefix',
1 verbose cli '/Users/rachitgoyal/functions',
1 verbose cli 'run',
1 verbose cli 'lint' ]
2 info using npm#6.4.1
3 info using node#v10.15.3
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/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/rachitgoyal/functions/node_modules/.bin:/Users/rachitgoyal/.npm-global/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle functions#~lint: CWD: /Users/rachitgoyal/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/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:189:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:189:13)
13 verbose stack at maybeClose (internal/child_process.js:970:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid functions#
15 verbose cwd /Users/rachitgoyal
16 verbose Darwin 18.5.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "--prefix" "/Users/rachitgoyal/functions" "run" "lint"
18 verbose node v10.15.3
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 ]
The funny thing here is that if I comment the below code in my index.js, the deployment works fine.
const payload = {
notification: {
title: "Added",
body: "Data Added"
}
};
admin.messaging().send(payload, false).then(result => {
console.log("Notification sent!");
});
So I'm assuming I'm doing something wrong with the initialization of the notification. Or I'm not returning the values to Promise properly. Any help here would be greatly appreciated.
Promise.all() and admin.messaging().send() both return a Promise, therefore you need to chain those promises.
However it is not clear why you do
const value = snap.data().original;
console.log('notifying ' + value);
return Promise.all([value])
.then(result => {
const value = result[0].data().value;
...
If you just want to use the value of value in your notification, you don't need to use Promise.all() at all and you should do as follows:
exports.makeUppercase = functions.firestore.document('messages/{messageId}')
.onCreate((snap, context) => {
const value = snap.data().original;
console.log('notifying ' + value);
const payload = {
notification: {
title: "Added",
body: value + "Data Added" //Here we use value
}
};
return admin.messaging().send(payload, false)
.then(result => { //Note that if you don't need the console.log you can get rid of this then()
console.log("Notification sent!");
return null;
});
});

Protractor: ENOTFOUND getaddrinfo ENOTFOUND localhost localhost:4444

Protractor doesn't start, it doesn't even open chrome.
it just gives me this error ENOTFOUND localhost localhost:4444 even though I've started webdriver-manager and I can access localhost:4444 in the browser. I'm not sure what to do with this, I've tried reinstalling Chrome, updating protractor & webdriver-manager, upgrading Node.js, flushed my DNS but I'm still having the error.
Error:
[11:11:21] I/launcher - Running 1 instances of WebDriver
[11:11:21] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[11:11:26] E/launcher - ENOTFOUND getaddrinfo ENOTFOUND localhost localhost:4444
[11:11:26] E/launcher - Error: ENOTFOUND getaddrinfo ENOTFOUND localhost localhost:4444
at ClientRequest.<anonymous> (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:238:15)
at emitOne (events.js:115:13)
at ClientRequest.emit (events.js:210:7)
at Socket.socketErrorListener (_http_client.js:400:9)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at emitErrorNT (internal/streams/destroy.js:62:8)
at _combinedTickCallback (internal/process/next_tick.js:102:11)
at process._tickCallback (internal/process/next_tick.js:161:9)
From: Task: WebDriver.createSession()
at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:777:24)
at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/chrome.js:709:29)
at createDriver (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/index.js:167:33)
at Builder.build (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/index.js:623:16)
at Hosted.getNewDriver (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:53:33)
at Runner.createBrowser (/usr/local/lib/node_modules/protractor/built/runner.js:195:43)
at q.then.then (/usr/local/lib/node_modules/protractor/built/runner.js:339:29)
at _fulfilled (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:796:13)
at /usr/local/lib/node_modules/protractor/node_modules/q/q.js:556:49
at runSingle (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:137:13)
at flush (/usr/local/lib/node_modules/protractor/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:95:7)
at process._tickCallback (internal/process/next_tick.js:161:9)
at Function.Module.runMain (module.js:607:11)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3
This is the log provided by NPM:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/8.1.3/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'tests' ]
2 info using npm#5.0.4
3 info using node#v8.1.3
4 verbose run-script [ 'pretests', 'tests', 'posttests' ]
5 info lifecycle angular-app#1.0.1~pretests: angular-app#1.0.1
6 silly lifecycle angular-app#1.0.1~pretests: no script for pretests, continuing
7 info lifecycle angular-app#1.0.1~tests: angular-app#1.0.1
8 verbose lifecycle angular-app#1.0.1~tests: unsafe-perm in lifecycle true
9 verbose lifecycle angular-app#1.0.1~tests: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/ChrisVillaran/Documents/Projects/angular-app/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/tools:/platform-tools:/Users/ChrisVillaran/.yarn/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/google_appengine/:/usr/local/bin/closure-compiler.jar
10 verbose lifecycle angular-app#1.0.1~tests: CWD: /Users/ChrisVillaran/Documents/Projects/angular-app
11 silly lifecycle angular-app#1.0.1~tests: Args: [ '-c', 'protractor tests/config.js' ]
12 silly lifecycle angular-app#1.0.1~tests: Returned: code: 199 signal: null
13 info lifecycle angular-app#1.0.1~tests: Failed to exec tests script
14 verbose stack Error: angular-app#1.0.1 tests: `protractor tests/config.js`
14 verbose stack Exit status 199
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)
14 verbose stack at emitTwo (events.js:125:13)
14 verbose stack at EventEmitter.emit (events.js:213:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:125:13)
14 verbose stack at ChildProcess.emit (events.js:213:7)
14 verbose stack at maybeClose (internal/child_process.js:897:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
15 verbose pkgid angular-app#1.0.1
16 verbose cwd /Users/ChrisVillaran/Documents/Projects/angular-app
17 verbose Darwin 14.5.0
18 verbose argv "/usr/local/Cellar/node/8.1.3/bin/node" "/usr/local/bin/npm" "run" "tests"
19 verbose node v8.1.3
20 verbose npm v5.0.4
21 error code ELIFECYCLE
22 error errno 199
23 error angular-app#1.0.1 tests: `protractor tests/config.js`
23 error Exit status 199
24 error Failed at the angular-app#1.0.1 tests script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 199, true ]
Selenium logs:
[14:57:32] I/start - java -Dwebdriver.chrome.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.30 -Dwebdriver.gecko.driver=/usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.17.0 -jar /usr/local/lib/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.4.0.jar -port 4444
[14:57:32] I/start - seleniumProcess.pid: 10704
14:57:33.378 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
14:57:33.379 INFO - Launching a standalone Selenium Server
2017-07-03 14:57:33.443:INFO::main: Logging initialized #590ms to org.seleniumhq.jetty9.util.log.StdErrLog
14:57:34.065 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC
14:57:34.065 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform MAC
14:57:34.065 INFO - Driver class not found: com.opera.core.systems.OperaDriver
14:57:34.065 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:
Unable to create new instances on this machine.
14:57:34.066 INFO - Driver class not found: com.opera.core.systems.OperaDriver
14:57:34.066 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
2017-07-03 14:57:34.188:INFO:osjs.Server:main: jetty-9.4.3.v20170317
2017-07-03 14:57:34.256:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler#14acaea5{/,null,AVAILABLE}
2017-07-03 14:57:34.321:INFO:osjs.AbstractConnector:main: Started ServerConnector#3bb3f24f{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
2017-07-03 14:57:34.322:INFO:osjs.Server:main: Started #1470ms
14:57:34.322 INFO - Selenium Server is up and running
Additional info:
Machine: OS X 10.10.5
Google Chrome: 59.0.3071.115
Node: 8.1.3
NPM: 5.0.4
Protractor: 5.1.2
Webdriver Manager: 12.0.6
My config:
let SpecReporter = require('jasmine-spec-reporter').SpecReporter;
exports.config = {
allScriptsTimeout: 1000 * 2500,
capabilities: {
'browserName': 'chrome'
},
onPrepare: function () {
jasmine.getEnv().addReporter(new SpecReporter({
spec: {
displayStacktrace: true
}
}));
},
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: [
'tests/specs/login-view/login.js'
],
jasmineNodeOpts: {
defaultTimeoutInterval: 1000 * 2500,
print: function() {}
}
};
Given that you're using OSX, you may be missing the line
127.0.0.1 localhost
from /etc/hosts
Try commenting the selenium address, as bellow. It should work.
//seleniumAddress: 'http://localhost:4444/wd/hub',
Comment below lines it works fine
exports.config = {
// seleniumAddress: 'http://chrome:4444/wd/hub',
// Capabilities to be passed to the webdriver instance.
capabilities: {
browserName: 'chrome'
},
specs: ['Protractor/todo-spec.js']
};

How to get output from node exec when running `npm install`?

I'm running the following:
const exec = require('child_process').exec;
let installProcess = exec('npm install');
installProcess.stdout.pipe(process.stdout);
installProcess.stderr.pipe(process.stderr);
But I get no output in my terminal, what else can I try?
The following ended up working for me:
const execSync = require('child_process').execSync;
execSync('npm install', {stdio:[0,1,2]});
This works perfectly
const exec = require('child_process').exec;
const installProcess = exec('npm install --verbose');
installProcess.stdout.on('data', process.stdout.write);
installProcess.stderr.on('data', process.stdout.write);
installProcess.on('close', (code) => process.stdout.write(`exited with ${code}`));
and the result
❯ node index.js
stderr: npm
stderr: info it worked if it ends with ok
npm verb cli [ '/usr/local/Cellar/node/6.3.0/bin/node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'install',
npm verb cli '--verbose' ]
npm info using npm#3.10.3
npm info using node#v6.3.0
stderr: npm verb
stderr: correctMkdir /Users/bwin/.npm/_locks correctMkdir not in flight; initializing
stderr: npm
stderr: info lifecycle tmp#1.0.0~preinstall: tmp#1.0.0
stderr: npm verb
stderr: exit [ 0, true ]
stderr: npm info
stderr: ok
exited with 0

npm start command is not working

I have tried running it using command line and in webstorm.
Earlier it was running smoothly but now it has stopped working.
I am not able to figure out what the error is?
If i look at line 13 it says failed to execute start script.
How can i rectify this error?
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/lib/node_modules/npm/bin/npm-cli.js',
1 verbose cli 'run-script',
1 verbose cli 'start' ]
2 info using npm#3.8.3
3 info using node#v4.4.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle WebDev#0.0.0~prestart: WebDev#0.0.0
6 silly lifecycle WebDev#0.0.0~prestart: no script for prestart, continuing
7 info lifecycle WebDev#0.0.0~start: WebDev#0.0.0
8 verbose lifecycle WebDev#0.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle WebDev#0.0.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/vardaan/Projects_Github/WebDev/node_modules/.bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
10 verbose lifecycle WebDev#0.0.0~start: CWD: /home/vardaan/Projects_Github/WebDev
11 silly lifecycle WebDev#0.0.0~start: Args: [ '-c', 'node ./bin/www' ]
12 silly lifecycle WebDev#0.0.0~start: Returned: code: 1 signal: null
13 info lifecycle WebDev#0.0.0~start: Failed to exec start script
14 verbose stack Error: WebDev#0.0.0 start: `node ./bin/www`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:239:16)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at EventEmitter.emit (events.js:172:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at ChildProcess.emit (events.js:172:7)
14 verbose stack at maybeClose (internal/child_process.js:827:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid WebDev#0.0.0
16 verbose cwd /home/vardaan/Projects_Github/WebDev
17 error Linux 3.19.0-58-generic
18 error argv "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/bin/npm-cli.js" "run-script" "start"
19 error node v4.4.0
20 error npm v3.8.3
21 error code ELIFECYCLE
22 error WebDev#0.0.0 start: `node ./bin/www`
22 error Exit status 1
23 error Failed at the WebDev#0.0.0 start script 'node ./bin/www'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the WebDev package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error node ./bin/www
23 error You can get information on how to open an issue for this project with:
23 error npm bugs WebDev
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls WebDev
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
The ./bin/www script is as follows
#!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../app');
var debug = require('debug')('WebDev:server');
var http = require('http');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}

grunt: problems npm with proxy

I am having problems with the proxy but I think it is ok about the configuration. It is when I just executing npm install.
my error in console is:
my file npm-debug.log tells me:
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 'grunt-contrib-concat',
1 verbose cli '--dev-save',
1 verbose cli '--global' ]
2 info using npm#2.11.3
3 info using node#v0.12.7
4 verbose install initial load of C:\Users\dmora\AppData\Roaming\npm\package.json
5 verbose readDependencies loading dependencies from C:\Users\dmora\AppData\Roaming\npm\package.json
6 silly cache add args [ 'grunt-contrib-concat', null ]
7 verbose cache add spec grunt-contrib-concat
8 silly cache add parsed spec { raw: 'grunt-contrib-concat',
8 silly cache add scope: null,
8 silly cache add name: 'grunt-contrib-concat',
8 silly cache add rawSpec: '',
8 silly cache add spec: '*',
8 silly cache add type: 'range' }
9 silly addNamed grunt-contrib-concat#*
10 verbose addNamed "*" is a valid semver range for grunt-contrib-concat
11 silly addNameRange { name: 'grunt-contrib-concat', range: '*', hasData: false }
12 silly mapToRegistry name grunt-contrib-concat
13 silly mapToRegistry using default registry
14 silly mapToRegistry registry http://registry.npmjs.org/
15 silly mapToRegistry uri http://registry.npmjs.org/grunt-contrib-concat
16 verbose addNameRange registry:http://registry.npmjs.org/grunt-contrib-concat not in flight; fetching
17 verbose request uri http://registry.npmjs.org/grunt-contrib-concat
18 verbose request no auth needed
19 info attempt registry request try #1 at 17:48:55
20 verbose request id 5852220cb81144b0
21 http request GET http://registry.npmjs.org/grunt-contrib-concat
22 info retry will retry, error on last attempt: Error: connect ECONNREFUSED
23 info attempt registry request try #2 at 17:49:06
24 http request GET http://registry.npmjs.org/grunt-contrib-concat
25 info retry will retry, error on last attempt: Error: connect ECONNREFUSED
26 info attempt registry request try #3 at 17:50:07
27 http request GET http://registry.npmjs.org/grunt-contrib-concat
28 verbose stack Error: connect ECONNREFUSED
28 verbose stack at exports._errnoException (util.js:746:11)
28 verbose stack at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)
29 verbose cwd D:\_PROYECTOS\Serunet CK.Client\SeruWeb\SN.CK.Front\Serunet.CK.Client.Web.Tests.ShowInBrowse
30 error Windows_NT 6.1.7601
31 error argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "grunt-contrib-concat" "--dev-save" "--global"
32 error node v0.12.7
33 error npm v2.11.3
34 error code ECONNREFUSED
35 error errno ECONNREFUSED
36 error syscall connect
37 error Error: connect ECONNREFUSED
37 error at exports._errnoException (util.js:746:11)
37 error at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)
37 error { [Error: connect ECONNREFUSED]
37 error code: 'ECONNREFUSED',
37 error errno: 'ECONNREFUSED',
37 error syscall: 'connect' }
38 error If you are behind a proxy, please make sure that the
38 error 'proxy' config is set properly. See: 'npm help config'
39 verbose exit [ 1, true ]
Finally I insert my .npmrc file:
proxy=http://Domain\user:password#xx.xx.xx.xx:8080/
https-proxy=http://Domain\user:password#xx.xx.xx.xx:8080/
registry=http://registry.npmjs.org/
strict-ssl = false
ca = null
.npmrc file is in directory: c:\users\myuser\.npmrc
I think everything is correct but it is giving me that errors.
What is wrong in configuration?
It was problem of the proxy of that corporation. Where I am now it is working fine. For me it is resolved.

Resources