npm run start, Failed at the start script - javascript

This is my first time using nodejs, I am getting the following error while running npm run start command. Is there a version compatibility issue between node and npm? I can see that the end lines suggesting this is not an issue with npm.
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/home/iamuser/.nvm/versions/node/v14.17.6/bin/node',
1 verbose cli '/home/iamuser/.nvm/versions/node/v14.17.6/bin/npm',
1 verbose cli 'run',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm#6.14.15
3 info using node#v14.17.6
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle test-api#1.0.0~prestart: test-api#1.0.0
6 info lifecycle test-api#1.0.0~start: test-api#1.0.0
7 verbose lifecycle test-api#1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle test-api#1.0.0~start: PATH: /home/iamuser/.nvm/versions/node/v14.17.6/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/iamuser/Documents/JS/rapid_api/test-api/node_modules/.bin:/home/iamuser/.nvm/versions/node/v14.17.6/bin:/home/iamuser/anaconda3/bin:/home/iamuser/anaconda3/condabin:/home/iamuser/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle test-api#1.0.0~start: CWD: /home/iamuser/Documents/JS/rapid_api/test-api
10 silly lifecycle test-api#1.0.0~start: Args: [ '-c', 'nodemon index.js' ]
11 info lifecycle test-api#1.0.0~start: Failed to exec start script
12 verbose stack Error: test-api#1.0.0 start: `nodemon index.js`
12 verbose stack spawn ENOENT
12 verbose stack at ChildProcess.<anonymous> (/home/iamuser/.nvm/versions/node/v14.17.6/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack at ChildProcess.emit (events.js:400:28)
12 verbose stack at maybeClose (internal/child_process.js:1055:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
13 verbose pkgid test-api#1.0.0
14 verbose cwd /home/iamuser/Documents/JS/rapid_api/test-api
15 verbose Linux 5.11.0-44-generic
16 verbose argv "/home/iamuser/.nvm/versions/node/v14.17.6/bin/node" "/home/iamuser/.nvm/versions/node/v14.17.6/bin/npm" "run" "start"
17 verbose node v14.17.6
18 verbose npm v6.14.15
19 error code ELIFECYCLE
20 error syscall spawn
21 error file sh
22 error errno ENOENT
23 error test-api#1.0.0 start: `nodemon index.js`
23 error spawn ENOENT
24 error Failed at the test-api#1.0.0 start script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
package.json:
{
"name": "test-api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon index.js"
},
"author": "iamuser",
"license": "ISC",
"dependencies": {
"axios": "^0.24.0",
"cheerio": "^1.0.0-rc.10",
"express": "^4.17.1"
}
}

As #ndenasie said, nodemon isn't installed. Try running npm install -g nodemon then npm run start and it should work.
Since the comment worked, this is just a response for you to mark as the best answer to close the thread.

Related

Some issue has been occurring for 2 days and I am unable to solve it in npm start

I have tried npm clear cache --force, removing node_modules/ and package-lock.json and then again npm install and then npm build and finally npm run dev. But unfortunately this failed around 5-6 times.
My Errors:
npm ERR! errno 1
npm ERR! with-redux-toolkit#1.0.0 build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the with-redux-toolkit#1.0.0 build 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\divya\AppData\Roaming\npm-cache\_logs\2021-08-25T14_05_46_415Z-debug.log
My debug logs:
0 info it worked if it ends with ok
1 verbose cli [
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 'run-script',
1 verbose cli 'build'
1 verbose cli ]
2 info using npm#6.14.14
3 info using node#v14.17.4
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle with-redux-toolkit#1.0.0~prebuild: with-redux-toolkit#1.0.0
6 info lifecycle with-redux-toolkit#1.0.0~build: with-redux-toolkit#1.0.0
7 verbose lifecycle with-redux-toolkit#1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle with-redux-toolkit#1.0.0~build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;M:\Amazon-starter-template-nextjs\node_modules\.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Users\divya\AppData\Local\Programs\AdoptOpenJDK\jdk-11.0.11.9-hotspot\bin;C:\Users\divya\AppData\Local\Microsoft\WindowsApps;;C:\Users\divya\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\divya\AppData\Roaming\npm
9 verbose lifecycle with-redux-toolkit#1.0.0~build: CWD: M:\Amazon-starter-template-nextjs
10 silly lifecycle with-redux-toolkit#1.0.0~build: Args: [ '/d /s /c', 'next build' ]
11 silly lifecycle with-redux-toolkit#1.0.0~build: Returned: code: 1 signal: null
12 info lifecycle with-redux-toolkit#1.0.0~build: Failed to exec build script
13 verbose stack Error: with-redux-toolkit#1.0.0 build: `next build`
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:332:16)
13 verbose stack at EventEmitter.emit (events.js:400:28)
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:400:28)
13 verbose stack at maybeClose (internal/child_process.js:1055:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid with-redux-toolkit#1.0.0
15 verbose cwd M:\Amazon-starter-template-nextjs
16 verbose Windows_NT 10.0.19042
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run-script" "build"
18 verbose node v14.17.4
19 verbose npm v6.14.14
20 error code ELIFECYCLE
21 error errno 1
22 error with-redux-toolkit#1.0.0 build: `next build`
22 error Exit status 1
23 error Failed at the with-redux-toolkit#1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
My package.json file:
{
"name": "with-redux-toolkit",
"version": "1.0.0",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"#heroicons/react": "^1.0.4",
"#reduxjs/toolkit": "1.5.0",
"#tailwindcss/line-clamp": "^0.2.0",
"firebase": "^8.6.1",
"firebase-admin": "^9.8.0",
"heroicons-react": "^1.4.1",
"hoist-non-react-statics": "^3.3.2",
"next": "^11.1.0",
"next-fonts": "^1.5.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "7.2.2"
},
"license": "MIT",
"devDependencies": {
"autoprefixer": "^10.2.5",
"postcss": "^8.2.15",
"tailwindcss": "^2.2.7"
}
}
As the error says itself, this is not a problem with NPM. Only we have to do is
instead of,
npm run build -prod
extend the javascript memory by following,
node --max_old_space_size=4096 node_modules/#angular/cli/bin/ng build --prod
npm install --cache /tmp/empty-cache
npm run build
(I tried cache clean but not work)

Why My Node Package Manager is giving me error after installing it and after running the pacakage.JSON file?

i am learning node.js. I initialized a package.json file in my project and I used a special lifecycle script "start" in my JSON file. Before initializing npm I ran "node app.js" command in terminal to run the code inside app.js. But when I ran the code using NPM, I am getting an error after running this command:
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/apple/.npm/_logs/2021-02-01T15_18_14_323Z-debug.log
here are the contents of the log file:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/Users/apple/.nvm/versions/node/v14.7.0/bin/node',
1 verbose cli '/Users/apple/.nvm/versions/node/v14.7.0/bin/npm',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm#6.14.7
3 info using node#v14.7.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle guide#1.0.0~prestart: guide#1.0.0
6 info lifecycle guide#1.0.0~start: guide#1.0.0
7 verbose lifecycle guide#1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle guide#1.0.0~start: PATH: /Users/apple/.nvm/versions/node/v14.7.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/apple/Desktop/guide/node_modules/.bin:/Users/apple/.nvm/versions/node/v14.7.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands
9 verbose lifecycle guide#1.0.0~start: CWD: /Users/apple/Desktop/guide
10 silly lifecycle guide#1.0.0~start: Args: [ '-c', 'node app.js' ]
11 silly lifecycle guide#1.0.0~start: Returned: code: 1 signal: null
12 info lifecycle guide#1.0.0~start: Failed to exec start script
13 verbose stack Error: guide#1.0.0 start: `node app.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/Users/apple/.nvm/versions/node/v14.7.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:314:20)
13 verbose stack at ChildProcess.<anonymous> (/Users/apple/.nvm/versions/node/v14.7.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:314:20)
13 verbose stack at maybeClose (internal/child_process.js:1051:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid guide#1.0.0
15 verbose cwd /Users/apple/Desktop/guide
16 verbose Darwin 17.7.0
17 verbose argv "/Users/apple/.nvm/versions/node/v14.7.0/bin/node" "/Users/apple/.nvm/versions/node/v14.7.0/bin/npm" "start"
18 verbose node v14.7.0
19 verbose npm v6.14.7
20 error code ELIFECYCLE
21 error errno 1
22 error guide#1.0.0 start: `node app.js`
22 error Exit status 1
23 error Failed at the guide#1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
You should write start like this : "start" : "node app.js". And you must install node_modules. For that you can write console npm i. Modules will install and it should not be a problem.
There are many things to do for creating a start script:
First things first, to initialize a node and npm project, there has to be a package.json file. It can be created manually, but it is advisable to use the command npm init in the terminal. This command walks you through creating a package.json file asking some questions. You can simply press enter, enter, if you want, but you could also answer them, no problem. You can also skip everything by running npm init -y instead of npm init.
Second, you have to create a script using the scripts object only, not anywhere else. To do that, open the file in your editor, look at where the object resides, or create a new object:
{
"name": "your-app",
"version": "0.0.1",
"main": "index.js",
"license": "ISC",
"scripts": {
"start": "node app.js" // here
}
}
Finally, run the script using the command npm run start in the terminal.

How to resolve the "functions predeploy error: Command terminated with non-zero exit code126"

I am getting the error below:
=== Deploying to 'nompu-website'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
functions# lint /home/superlelo/Desktop/publishToday/functions
eslint .
sh: 1: eslint: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! functions# lint: eslint .
npm ERR! Exit status 126
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! /home/superlelo/.npm/_logs/2019-09-24T15_05_43_357Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code126
When I run the command: firebase deploy --only functions. I get the same error when I am with or without admin privileges.
My package.json file looks like this:
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"build":"npm run build",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "8"
},
"dependencies": {
"firebase-admin": "^8.0.0",
"firebase-functions": "^3.1.0"
},
"devDependencies": {
"eslint": "^5.12.0",
"eslint-plugin-promise": "^4.0.1",
"firebase-functions-test": "^0.1.6"
},
"private": true
}
Here is the complete log file:
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/superlelo/Desktop/publishToday/functions',
1 verbose cli 'run',
1 verbose cli 'lint' ]
2 info using npm#6.9.0
3 info using node#v10.16.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/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/superlelo/Desktop/publishToday/functions/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/usr/games:/sbin:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/superlelo/bin:/usr/bin/java/bin:/home/superlelo/Android/sdk/emulator:/home/superlelo/Android/sdk/tools:/home/superlelo/Android/sdk/tools/bin:/home/superlelo/Android/sdk/platform-tools
9 verbose lifecycle functions#~lint: CWD: /home/superlelo/Desktop/publishToday/functions
10 silly lifecycle functions#~lint: Args: [ '-c', 'eslint .' ]
11 silly lifecycle functions#~lint: Returned: code: 126 signal: null
12 info lifecycle functions#~lint: Failed to exec lint script
13 verbose stack Error: functions# lint: `eslint .`
13 verbose stack Exit status 126
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:198: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:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid functions#
15 verbose cwd /home/superlelo/Desktop/publishToday
16 verbose Linux 4.15.0-64-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "--prefix" "/home/superlelo/Desktop/publishToday/functions" "run" "lint"
18 verbose node v10.16.3
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 126
22 error functions# lint: `eslint .`
22 error Exit status 126
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 [ 126, true ]
Can anyone suggest how can I resolve this? I am using npm 6.9.0 on a linux Ubuntu bionic beaver.
Thanks

npm run build gives out npm ERR! code ELIFECYCLE

I'm very new to Node.js and Electron and wanted to run npm run build. Unfortunately, that only gives me out the error code ELIFECYCLE.
Here is my package.json:
{
"name": "firstelectronproject",
"version": "0.1.0",
"description": "My first Electron project",
"main": "main.js",
"scripts": {
"start": "electron index.js",
"package": "",
"build": "electron-packager . FEP"
},
"author": "F9lke <florian.thomasgoetzrath.de>",
"license": "MIT",
"dependencies": {
"electron": "^1.6.11"
},
"devDependencies": {
"asar": "^0.13.0",
"electron-packager": "^8.7.2"
}
}
Here is the log of my command prompt:
D:\Eigene Dateien\Desktop\Coding\Desktop Apps\FEP>npm run build
> firstelectronproject#0.1.0 build D:\Eigene Dateien\Desktop\Coding\Desktop Apps\FEP
> electron-packager . FEP
Packaging app for platform win32 x64 using electron v1.6.11
Command failed: npm prune --production
npm WARN invalid config loglevel="notice"
npm WARN firstelectronproject#0.1.0 No repository field.
npm ERR! May not delete: C:\Users\User\AppData\Local\Temp\electron-packager\win32-x64\FEP-win32-x64\resources\app\node_modules\.bin
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Roaming\npm-cache\_logs\2017-07-21T11_38_37_230Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! firstelectronproject#0.1.0 build: `electron-packager . FEP`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the firstelectronproject#0.1.0 build 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\2017-07-21T11_38_37_293Z-debug.log
And here is the log output:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using npm#5.3.0
3 info using node#v6.11.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle firstelectronproject#0.1.0~prebuild: firstelectronproject#0.1.0
6 info lifecycle firstelectronproject#0.1.0~build: firstelectronproject#0.1.0
7 verbose lifecycle firstelectronproject#0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle firstelectronproject#0.1.0~build: PATH: C:\Users\User\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;D:\Eigene Dateien\Desktop\Coding\Desktop Apps\FEP\node_modules\.bin;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Brackets\command;C:\Program Files\nodejs\;C:\Users\User\AppData\Local\Microsoft\WindowsApps;C:\Users\User\AppData\Local\atom\bin;C:\Users\User\AppData\Roaming\npm
9 verbose lifecycle firstelectronproject#0.1.0~build: CWD: D:\Eigene Dateien\Desktop\Coding\Desktop Apps\FEP
10 silly lifecycle firstelectronproject#0.1.0~build: Args: [ '/d /s /c', 'electron-packager . FEP' ]
11 silly lifecycle firstelectronproject#0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle firstelectronproject#0.1.0~build: Failed to exec build script
13 verbose stack Error: firstelectronproject#0.1.0 build: `electron-packager . FEP`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:289:16)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at EventEmitter.emit (events.js:191:7)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at ChildProcess.emit (events.js:191:7)
13 verbose stack at maybeClose (internal/child_process.js:891:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
14 verbose pkgid firstelectronproject#0.1.0
15 verbose cwd D:\Eigene Dateien\Desktop\Coding\Desktop Apps\FEP
16 verbose Windows_NT 10.0.15063
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v6.11.1
19 verbose npm v5.3.0
20 error code ELIFECYCLE
21 error errno 1
22 error firstelectronproject#0.1.0 build: `electron-packager . FEP`
22 error Exit status 1
23 error Failed at the firstelectronproject#0.1.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
This seems to be related to a bug in electron-packager. As a workaround you could downgrade electron-packager to e.g. ^7.7.0. Also, you need to update the build command slightly, see below (Note, only showing the relevant parts):
{
"scripts": {
"build": "electron-packager ./ --platform=linux --arch=x64"
},
"dependencies": {
"electron": "^1.6.11"
},
"devDependencies": {
"electron-packager": "^7.7.0"
}
}
Note that you can use --all to build for all platforms.
Updating npm on server worked for me.
I solved this problem by installing the array unique and it started working:
npm install --save array-unique
I encountered a similar problem with electron-packager. Just added ./ --all to the end of the pack directive. Final result given below:
"pack": "electron-packager ./ --all"

Angular 2 : transpilation and start cmds failed

I'm new with Angular 2 and I have some errors while launching a basic app. I just create a new component and boostrap it. Nothing more.
Here is my package.json :
{
"name": "angular2-quickstart",
"version": "1.0.0",
"scripts": {
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"typings": "typings",
"postinstall": "typings install"
},
"license": "ISC",
"dependencies": {
"#ngrx/store": "^1.3.3",
"angular2": "2.0.0-beta.9",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"systemjs": "0.19.24",
"zone.js": "0.5.15"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.1.0",
"typescript": "^1.8.7",
"typings": "^0.7.5"
}
}
I have the latests versions of node & npm. I also installed globally the devDependencies.
My error log when I tried to npm run tsc:
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 'run',
1 verbose cli 'tsc' ]
2 info using npm#3.7.3
3 info using node#v5.8.0
4 verbose run-script [ 'pretsc', 'tsc', 'posttsc' ]
5 info lifecycle angular2-quickstart#1.0.0~pretsc: angular2-quickstart#1.0.0
6 silly lifecycle angular2-quickstart#1.0.0~pretsc: no script for pretsc, continuing
7 info lifecycle angular2-quickstart#1.0.0~tsc: angular2-quickstart#1.0.0
8 verbose lifecycle angular2-quickstart#1.0.0~tsc: unsafe-perm in lifecycle true
9 verbose lifecycle angular2-quickstart#1.0.0~tsc: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;D:\__\mdev\node_modules\.bin;C:\Program Files\nodejs;C:\cmder\bin;C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\share\vim\vim74;C:\cmder\vendor\conemu-maximus5;C:\cmder\vendor\conemu-maximus5\ConEmu;C:\Ruby22-x64\bin;C:\Program Files (x86)\OpenSSH\bin;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\nodejs\;C:\Program Files (x86)\IDM Computer Solutions\UltraEdit\;C:\Users\cflodrops\Downloads\windows-7.0.0\windrush;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files\Oracle\VirtualBox;C:\Program Files\Git\bin;C:\MinGW\bin;C:\wamp\bin\mysql\mysql5.6.17\bin;C:\Users\cflodrops\AppData\Local\atom\bin;C:\ProgramData\Drush\;C:\Program Files (x86)\Drush\GnuWin32\bin;C:\Program Files (x86)\Drush\Php;C:\Program Files (x86)\Drush\cwRsync\bin;C:\Program Files (x86)\Microsoft VS Code\bin;\\sdossier.groupe.zzroot.com\dossiers$\cflodrops\AppData\npm;C:\cmder
10 verbose lifecycle angular2-quickstart#1.0.0~tsc: CWD: D:\__\mdev
11 silly lifecycle angular2-quickstart#1.0.0~tsc: Args: [ '/d /s /c', 'tsc' ]
12 silly lifecycle angular2-quickstart#1.0.0~tsc: Returned: code: 2 signal: null
13 info lifecycle angular2-quickstart#1.0.0~tsc: Failed to exec tsc script
14 verbose stack Error: angular2-quickstart#1.0.0 tsc: `tsc`
14 verbose stack Exit status 2
14 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:239:16)
14 verbose stack at emitTwo (events.js:100:13)
14 verbose stack at EventEmitter.emit (events.js:185:7)
14 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
14 verbose stack at emitTwo (events.js:100:13)
14 verbose stack at ChildProcess.emit (events.js:185:7)
14 verbose stack at maybeClose (internal/child_process.js:850:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid angular2-quickstart#1.0.0
16 verbose cwd D:\__\mdev
17 error Windows_NT 6.1.7601
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "tsc"
19 error node v5.8.0
20 error npm v3.7.3
21 error code ELIFECYCLE
22 error angular2-quickstart#1.0.0 tsc: `tsc`
22 error Exit status 2
23 error Failed at the angular2-quickstart#1.0.0 tsc script 'tsc'.
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 angular2-quickstart package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error tsc
23 error You can get information on how to open an issue for this project with:
23 error npm bugs angular2-quickstart
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls angular2-quickstart
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
And when I execute npm start:
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 'run',
1 verbose cli 'lite' ]
2 info using npm#3.7.3
3 info using node#v5.8.0
4 verbose run-script [ 'prelite', 'lite', 'postlite' ]
5 info lifecycle angular2-quickstart#1.0.0~prelite: angular2-quickstart#1.0.0
6 silly lifecycle angular2-quickstart#1.0.0~prelite: no script for prelite, continuing
7 info lifecycle angular2-quickstart#1.0.0~lite: angular2-quickstart#1.0.0
8 verbose lifecycle angular2-quickstart#1.0.0~lite: unsafe-perm in lifecycle true
9 verbose lifecycle angular2-quickstart#1.0.0~lite: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;D:\__\mdev\node_modules\.bin;C:\Program Files\nodejs;C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;D:\__\mdev\node_modules\.bin;C:\Program Files\nodejs;C:\cmder\bin;C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\share\vim\vim74;C:\cmder\vendor\conemu-maximus5;C:\cmder\vendor\conemu-maximus5\ConEmu;C:\Ruby22-x64\bin;C:\Program Files (x86)\OpenSSH\bin;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\nodejs\;C:\Program Files (x86)\IDM Computer Solutions\UltraEdit\;C:\Users\cflodrops\Downloads\windows-7.0.0\windrush;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files\Oracle\VirtualBox;C:\Program Files\Git\bin;C:\MinGW\bin;C:\wamp\bin\mysql\mysql5.6.17\bin;C:\Users\cflodrops\AppData\Local\atom\bin;C:\ProgramData\Drush\;C:\Program Files (x86)\Drush\GnuWin32\bin;C:\Program Files (x86)\Drush\Php;C:\Program Files (x86)\Drush\cwRsync\bin;C:\Program Files (x86)\Microsoft VS Code\bin;\\sdossier.groupe.zzroot.com\dossiers$\cflodrops\AppData\npm;C:\cmder
10 verbose lifecycle angular2-quickstart#1.0.0~lite: CWD: D:\__\mdev
11 silly lifecycle angular2-quickstart#1.0.0~lite: Args: [ '/d /s /c', 'lite-server' ]
12 silly lifecycle angular2-quickstart#1.0.0~lite: Returned: code: 1 signal: null
13 info lifecycle angular2-quickstart#1.0.0~lite: Failed to exec lite script
14 verbose stack Error: angular2-quickstart#1.0.0 lite: `lite-server`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:239:16)
14 verbose stack at emitTwo (events.js:100:13)
14 verbose stack at EventEmitter.emit (events.js:185:7)
14 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
14 verbose stack at emitTwo (events.js:100:13)
14 verbose stack at ChildProcess.emit (events.js:185:7)
14 verbose stack at maybeClose (internal/child_process.js:850:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid angular2-quickstart#1.0.0
16 verbose cwd D:\__\mdev
17 error Windows_NT 6.1.7601
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "lite"
19 error node v5.8.0
20 error npm v3.7.3
21 error code ELIFECYCLE
22 error angular2-quickstart#1.0.0 lite: `lite-server`
22 error Exit status 1
23 error Failed at the angular2-quickstart#1.0.0 lite script 'lite-server'.
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 angular2-quickstart package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error lite-server
23 error You can get information on how to open an issue for this project with:
23 error npm bugs angular2-quickstart
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls angular2-quickstart
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
Okay so the issue comes from lite-server. I've decided to install http-server and change my package.json like that :
{
"name": "angular2-quickstart",
"version": "1.0.0",
"scripts": {
"start": "concurrently \"npm run tsc:w\" \"npm run http\" ",
"tsc": "tsc -p .",
"tsc:w": "tsc -w -p .",
"lite": "nano-server",
"http": "http-server -p 3000 -a 127.0.0.1 -o",
"typings": "typings",
"postinstall": "typings install"
},
"license": "ISC",
"dependencies": {
"#ngrx/store": "^1.3.3",
"angular2": "2.0.0-beta.9",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"systemjs": "0.19.24",
"zone.js": "0.5.15"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.1.0",
"http-server": "^0.9.0",
"typescript": "^1.8.7",
"typings": "^0.7.5"
}
}
And it works. Thanks for your help !

Categories