'parcel' is not recognized as an internal or external command, operable program or batch file. ERROR for Parcel bundler in Vanilla TYPESCRIPT Code - node.js

This error is showed up when I ran the code for an Arkanoid Game published on freecodecamp articles. I am not able to set up the configuration correctly for the game. I expected it to run the game but it didn't do the same. While debugging it kept throwing errors regarding its build. I have no idea as I have learned it online but this error is not getting resolve.
I am attaching both the debugger image and the error image along with the log file text, where it showed the error.
DEBUG CONSOLE
TERMINAL
0 verbose cli [
0 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
0 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli 'start'
0 verbose cli ]
1 info using npm#7.5.3
2 info using node#v15.9.0
3 timing config:load:defaults Completed in 4ms
4 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 5ms
5 timing config:load:builtin Completed in 5ms
6 timing config:load:cli Completed in 6ms
7 timing config:load:env Completed in 2ms
8 timing config:load:file:D:\arkanoid-ts-startHere\.npmrc Completed in 1ms
9 timing config:load:project Completed in 2ms
10 timing config:load:file:C:\Users\WELCOME\.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:C:\Users\WELCOME\AppData\Roaming\npm\etc\npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 1ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 2ms
17 timing config:load:setEnvs Completed in 3ms
18 timing config:load Completed in 27ms
19 verbose npm-session 84c35795bdcebad3
20 timing npm:load Completed in 60ms
21 timing command:run-script Completed in 146ms
22 timing command:start Completed in 163ms
23 verbose stack Error: command failed
23 verbose stack at ChildProcess.<anonymous> (C:\Program
Files\nodejs\node_modules\npm\node_modules\#npmcli\promise-spawn\index.js:64:27)
23 verbose stack at ChildProcess.emit (node:events:378:20)
23 verbose stack at maybeClose (node:internal/child_process:1067:16)
23 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
24 verbose pkgid ts-parcel#1.0.0
25 verbose cwd D:\arkanoid-ts-startHere
26 verbose Windows_NT 10.0.19042
27 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program
Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
28 verbose node v15.9.0
29 verbose npm v7.5.3
30 error code 1
31 error path D:\arkanoid-ts-startHere
32 error command failed
33 error command C:\WINDOWS\system32\cmd.exe /d /s /c parcel serve src/index.html
34 verbose exit 1
This is package.json file
{
"name": "ts-parcel",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "parcel serve src/index.html",
"watch": "parcel watch src/index.html"
},
"type": "module",
"author": "",
"license": "ISC",
"devDependencies": {
"#typescript-eslint/eslint-plugin": "^4.11.0",
"#typescript-eslint/parser": "^4.11.0",
"eslint": "^7.16.0",
"eslint-config-prettier": "^7.1.0",
"eslint-plugin-prettier": "^3.3.0",
"parcel": "^1.12.4",
"prettier": "^2.2.1",
"typescript": "^4.1.3"
}
}
This is index.ts file
import {CanvasView} from './view/CanvasView';
import {Ball} from './sprites/Ball';
import {Brick} from './sprites/Brick';
import {Paddle} from './sprites/Paddle';
import {Collision} from './Collision';
//Images
import PADDLE_IMAGE from './images/paddle.png';
import BALL_IMAGE from './images/ball.png';
import BRICK_IMAGE from './images/brick.png';
//level and colors
import{
PADDLE_SPEED,
PADDLE_WIDTH,
PADDLE_HEIGHT,
PADDLE_STARTX,
BALL_SPEED,
BALL_SIZE,
BALL_STARTX,
BALL_STARTY
} from './setup';
//helpers
import {createBricks} from './helpers';
let gameOver = false;
let score = 0;
function setGameOver(view: CanvasView){
view.drawInfo('Game Over!');
gameOver = false;
}
function setGameWin(view: CanvasView){
view.drawInfo('Game Won!!!');
gameOver = false;
}
function gameLoop(
view: CanvasView,
bricks:Brick[],
paddle: Paddle,
ball: Ball,
collision: Collision
){
console.log("draw!");
view.clear();
view.drawBricks(bricks);
view.drawSprite(paddle);
view.drawSprite(ball);
//move ball
ball.moveBall();
//move paddle and check as it won't exit the playField
if(
(paddle.isMovingLeft && paddle.pos.x > 0) ||
(paddle.isMovingRight && paddle.pos.x < view.canvas.width - paddle.width)
){
paddle.movePaddle();
}
collision.checkBallCollision(ball, paddle, view);
const collidingBrick = collision.isCollidingBricks(ball, bricks);
if(collidingBrick){
score += 1;
view.drawScore(score);
}
//GAME OVER!!! when ball leaves playField
if(ball.pos.y > view.canvas.height) gameOver = true;
//if game won, set gameOver and display win
if(bricks.length === 0) return setGameWin(view);
//return if gameOver and don't run the requestAnimationFrame
if(gameOver) return setGameOver(view);
requestAnimationFrame(() => gameLoop(view,bricks,paddle,ball,collision));
}
function startGame(view:CanvasView){
//reset display
score = 0;
view.drawInfo('');
view.drawScore(0);
//create collision
const collision = new Collision();
//create all bricks
const bricks = createBricks();
//create all paddle
const paddle = new Paddle(
PADDLE_SPEED,
PADDLE_WIDTH,
PADDLE_HEIGHT,
{
x: PADDLE_STARTX,
y: view.canvas.height - PADDLE_HEIGHT - 5
},
PADDLE_IMAGE
)
//create a ball
const ball = new Ball(
BALL_SPEED,
BALL_SIZE,
{x: BALL_STARTX, y: BALL_STARTY},
BALL_IMAGE
);
gameLoop(view, bricks, paddle, ball, collision);
}
//create a view
const view = new CanvasView('#playField');
view.initStartButton(startGame);
This is CanvasView.ts file
import {Brick} from '../sprites/Brick';
import {Ball} from '../sprites/Ball';
import {Paddle} from '../sprites/Paddle';
import { BRICK_IMAGES } from '~/setup';
export class CanvasView{
canvas: HTMLCanvasElement;
private context: CanvasRenderingContext2D | null;
private scoreDisplay: HTMLObjectElement | null;
private start: HTMLObjectElement | null;
private info: HTMLObjectElement| null;
constructor(canvasName: string){
this.canvas = document.querySelector(canvasName) as HTMLCanvasElement;
this.context = this.canvas.getContext('2d');
this.scoreDisplay = document.querySelector('#score');
this.start = document.querySelector('#start');
this.info = document.querySelector('#info');
}
clear(): void{
this.context?.clearRect(0,0,this.canvas.width, this.canvas.height);
}
initStartButton(startFunction: (view:CanvasView) => void): void{
this.start?.addEventListener('click', () => startFunction(this));
}
drawScore(score: number): void{
if(this.scoreDisplay) this.scoreDisplay.innerHTML = score.toString();
}
drawInfo(text: string): void{
if(this.info) this.info.innerHTML = text;
}
drawSprite(brick: Brick | Paddle | Ball): void{
if(!brick) return;
this.context?.drawImage(
brick.image,
brick.pos.x,
brick.pos.y,
brick.width,
brick.height
);
}
drawBricks(bricks: Brick[]): void{
bricks.forEach(brick => this.drawSprite(brick));
}
}
The above codes are the mainframe of the game. Hope it helps to resolve.

To be able to load an ES module, we need to set “type”: “module” in this file or, as an alternative, we can use the .mjs file extension as against the usual .js file extension.
In your package.json file add this:
{
"type": "module",
}
For an example:
{
"name": "esm",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"type": "module",
"author": "",
"license": "ISC"
}
If this doesn't work uninstalling both global and local versions of parcel:
npm uninstall parcel
npm uninstall -g parcel
Then install it using this command:
npm install parcel --save-dev

I have been getting this error while using parcel index.html to start the parcel deployment server.
On reading the official documentation I found out the correct command to do that:
npx parcel index.html
It worked as expected on using that command!

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;
});
});

Unable to deploy cloud functions

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.');
});
});
});

ImageMagick 7.0.4 / NodeJS 6.9.2 / GPLGS 9.15 / Win 7: Failing to convert files

Problem
I am able to do a conversion from PDF to another image format from the command-line using the convert.exe ImageMagick command. However, when running the following JS in Node I get the error that follows the code below.
JavaScript
fs = require('fs');
var PDFImage = require("pdf-image").PDFImage;
console.log("Start");
var pdfImage = new PDFImage('test.pdf');
pdfImage.convertPage(0).then(function (imagePath) {
// 0-th page (first page) of the slide.pdf is available as slide-0.png
console.log('Converted');
fs.existsSync('test-0.png') // => true
}, function (err) {
console.log(err);
});
package.json
{
"name": "pdftester",
"version": "1.0.0",
"description": "PDF Tester",
"main": "PDFTester.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "John Doe",
"license": "ISC",
"dependencies": {
"async": "^2.1.4",
"imagemagick": "^0.1.3",
"pdf-image": "^1.1.0",
"pdftotextjs": "^0.4.0"
}
}
Results
Start
{ message: 'Failed to convert page to image',
error:
{ Error: Command failed: convert 'test.pdf[0]' 'test-0.png'
convert: unable to open image ''test.pdf[0]'': No such file or directory # error/blob.c/OpenBlob/2691.
convert: unable to open module file 'C:\ImageMagick-7.0.4-Q16\modules\coders\IM_MOD_RL_PDF[0]'_.dll': No such file or directory # warning/module.c/GetMagickModulePath/680.
convert: no decode delegate for this image format `PDF[0]'' # error/constitute.c/ReadImage/509.
convert: no images defined `'test-0.png'' # error/convert.c/ConvertImageCommand/3254.
at ChildProcess.exithandler (child_process.js:206:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Socket.<anonymous> (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:498:12)
killed: false,
code: 1,
signal: null,
cmd: 'convert \'test.pdf[0]\' \'test-0.png\'' },
stdout: '',
stderr: 'convert: unable to open image \'\'test.pdf[0]\'\': No such file or directory # error/blob.c/OpenBlob/2691.\r\nconvert: unable to open module file \'C:\\ImageMagick-7.0.4-Q16\\modules\\coders\\IM_MOD_RL_PDF[0]\'_.dll\': No such file or directory # warning/module.c/GetMagickModulePath/680.\r\nconvert: no decode delegate for this image format `PDF[0]\'\' # error/constitute.c/ReadImage/509.\r\nconvert: no images defined `\'test-0.png\'\' # error/convert.c/ConvertImageCommand/3254.\r\n' }
Analysis
The offending line is the command-line built for convert.exe, that is:
'convert \'test.pdf[0]\' \'test-0.png\''
What is adding the extra slashes, ticks ('), and '[0]'?
Thanks in advance!
according to your question , extra slashes denotes to enter in folder.
you have to put your file with respect to server file from where it starts. or put your pdf file into from where your running your apps.

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