npm error while installing express in nodejs - node.js

I am facing a problem while npm install express. Unexpected end of JSON input while parsing near '..."dist":{"shasum":"e84' this is the erroe i am getting.
> 0 info it worked if it ends with ok
> 1 verbose cli [ 'D:\\Program Files\\nodejs\\node.exe',
> 1 verbose cli 'C:\\Users\\Rakshith Rakshak\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
> 1 verbose cli 'install',
> 1 verbose cli '-g',
> 1 verbose cli 'express' ]
> 2 info using npm#6.9.2
> 3 info using node#v10.15.3
> 4 verbose npm-session 203510227a9454ec
> 5 silly install loadCurrentTree
> 6 silly install readGlobalPackageData
> 7 http fetch GET 304 https://registry.npmjs.org/express 346ms (from cache)
> 8 silly fetchPackageMetaData error for express#latest Unexpected end of JSON input while parsing near
> '..."dist":{"shasum":"e84'
> 9 timing stage:rollbackFailedOptional Completed in 1ms
> 10 timing stage:runTopLevelLifecycles Completed in 417ms
> 11 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '..."dist":{"shasum":"e84'
> 11 verbose stack at JSON.parse (<anonymous>)
> 11 verbose stack at parseJson (C:\Users\Rakshith Rakshak\AppData\Roaming\npm\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
> 11 verbose stack at consumeBody.call.then.buffer (C:\Users\Rakshith
> Rakshak\AppData\Roaming\npm\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50)
> 11 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7)
> 12 verbose cwd D:\My Files\node\role-based-auth
> 13 verbose Windows_NT 10.0.18362
> 14 verbose argv "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Rakshith
> Rakshak\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js"
> "install" "-g" "express"
> 15 verbose node v10.15.3
> 16 verbose npm v6.9.2
> 17 error Unexpected end of JSON input while parsing near '..."dist":{"shasum":"e84'
> 18 verbose exit [ 1, true ]

Clear NPM cache and try installing 'Express' again. Run Below command
npm cache clean --force
then install express
npm install express

Related

How to generate Typescript-Client with openapi-typescript-codegen?

When i install openapi-typescript-codegen
as described in the readme with $ npm install openapi-typescript-codegen --save-dev
it generates a package-lock.json but no package.json and no tsconfig.json. Even if i maually create the package.json and run npm run generate-client it does not work. And throws this log at me:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'generate-client' ]
2 info using npm#6.14.4
3 info using node#v10.19.0
4 verbose run-script [ 'pregenerate-client',
4 verbose run-script 'generate-client',
4 verbose run-script 'postgenerate-client' ]
5 info lifecycle frontend-api-client#1.0.0~pregenerate-client: frontend-api-client#1.0.0
6 info lifecycle frontend-api-client#1.0.0~generate-client: frontend-api-client#1.0.0
7 verbose lifecycle frontend-api-client#1.0.0~generate-client: unsafe-perm in lifecycle true
8 verbose lifecycle frontend-api-client#1.0.0~generate-client: PATH: /usr/share/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/tom/Arbeit/Frontend-API-Client/node_modules/.bin:/home/tom/.local/bin:/opt/ros/foxy/bin:/home/tom/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle frontend-api-client#1.0.0~generate-client: CWD: /home/tom/Arbeit/Frontend-API-Client
10 silly lifecycle frontend-api-client#1.0.0~generate-client: Args: [ '-c',
10 silly lifecycle 'openapi --input http://0.0.0.0:8000/openapi.json --output ./src/client --client axios' ]
11 silly lifecycle frontend-api-client#1.0.0~generate-client: Returned: code: 1 signal: null
12 info lifecycle frontend-api-client#1.0.0~generate-client: Failed to exec generate-client script
13 verbose stack Error: frontend-api-client#1.0.0 generate-client: `openapi --input http://0.0.0.0:8000/openapi.json --output ./src/client --client axios`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/share/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 frontend-api-client#1.0.0
15 verbose cwd /home/tom/Arbeit/Frontend-API-Client
16 verbose Linux 5.13.0-40-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "generate-client"
18 verbose node v10.19.0
19 verbose npm v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error frontend-api-client#1.0.0 generate-client: `openapi --input http://0.0.0.0:8000/openapi.json --output ./src/client --client axios`
22 error Exit status 1
23 error Failed at the frontend-api-client#1.0.0 generate-client script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Im currently trying to use the tutorial from FastAPI Generate Clients.
Can anybody help me?
NPM version was to old, in the end that was the only issue.

Error when using npm start for a react app

I created a react app folder using "create-react-app" it worked well and when I tried "npm start" to is throwing errors. I have uninstalled and reinstalled, I tried setting path in the environment variables. Whatever I try it the same error over and over again.
The Error Message
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\sreem\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm#6.14.5
3 info using node#v14.3.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle movie#0.1.0~prestart: movie#0.1.0
6 info lifecycle movie#0.1.0~start: movie#0.1.0
7 verbose lifecycle movie#0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle movie#0.1.0~start: PATH:
C:\Users\sreem\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\sreem\Desktop\movie\node_modules\.bin;C:\Python38\Scripts\;C:\Python38\;C:\Program Files\JetBrains\Intellij IDEA Community Edition 2019.1.3\plugins\Kotlin\kotlinc\bin;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\Java\jdk-14.0.1\bin;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.1.1\bin;;C:\Users\sreem\Documents\Microsoft VS Code\bin;C:\Users\sreem\AppData\Roaming\npm
9 verbose lifecycle movie#0.1.0~start: CWD: C:\Users\sreem\Desktop\movie
10 silly lifecycle movie#0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle movie#0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle movie#0.1.0~start: Failed to exec start script
13 verbose stack Error: movie#0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous>
(C:\Users\sreem\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\sreem\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315: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 movie#0.1.0
15 verbose cwd C:\Users\sreem\Desktop\movie
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\sreem\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v14.3.0
19 verbose npm v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error movie#0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the movie#0.1.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 ]

Having exit status 1 on react compilation with nextjs

Hi im having this error and i have no idea why it is... i did a lot of research but didnt find what i need.
I have next js and the script for npm run build is like this "next build"
and this issue is happening now over and over again.
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',
1 verbose cli 'build'
1 verbose cli ]
2 info using npm#6.10.0
3 info using node#v12.7.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle start-p#1.0.0~prebuild: start-p#1.0.0
6 info lifecycle start-p#1.0.0~build: start-p#1.0.0
7 verbose lifecycle start-p#1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle start-p#1.0.0~build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Rion\Desktop\InvisReact\invis\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Users\Rion\AppData\Local\Microsoft\WindowsApps;C:\Users\Rion\AppData\Roaming\npm;C:\Program Files\nodejs;C:\Program Files\heroku\bin;C:\Users\Rion\AppData\Local\atom\bin;C:\Users\Rion\AppData\Roaming\Composer\vendor\bin;C:\Users\Rion\AppData\Local\Programs\Microsoft VS Code\bin
9 verbose lifecycle start-p#1.0.0~build: CWD: C:\Users\Rion\Desktop\InvisReact\invis
10 silly lifecycle start-p#1.0.0~build: Args: [ '/d /s /c', 'next build' ]
11 silly lifecycle start-p#1.0.0~build: Returned: code: 1 signal: null
12 info lifecycle start-p#1.0.0~build: Failed to exec build script
13 verbose stack Error: start-p#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:301:16)
13 verbose stack at EventEmitter.emit (events.js:203: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:203:13)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid start-p#1.0.0
15 verbose cwd C:\Users\Rion\Desktop\InvisReact\invis
16 verbose Windows_NT 10.0.17763
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v12.7.0
19 verbose npm v6.10.0
20 error code ELIFECYCLE
21 error errno 1
22 error start-p#1.0.0 build: `next build`
22 error Exit status 1
23 error Failed at the start-p#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 ]
Thank you.

heroku run locally command give me the following error in node js ,what are the possible reason?

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 'start' ]
2 info using npm#6.4.1
3 info using node#v10.15.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle btc#1.0.0~prestart: btc#1.0.0
6 info lifecycle btc#1.0.0~start: btc#1.0.0
7 verbose lifecycle btc#1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle btc#1.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\THOR\Desktop\btc\node_modules.bin;C:\Program Files Files\MongoDB\Server\4.0\bin;C:\Program Files\Java\jdk-10.0.1\bin;C:\Program Files\nodejs;C:\Program Files\Git\bin;c:\windows\system32;C:\Users\THOR\AppData\Local\Microsoft\WindowsApps;C:\Users\THOR\AppData\Roaming\npm;C:\Users\THOR\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\heroku\bin
9 verbose lifecycle btc#1.0.0~start: CWD: C:\Users\THOR\Desktop\btc
10 silly lifecycle btc#1.0.0~start: Args: [ '/d /s /c', 'app.js' ]
11 silly lifecycle btc#1.0.0~start: Returned: code: 1 signal: null
12 info lifecycle btc#1.0.0~start: Failed to exec start script
13 verbose stack Error: btc#1.0.0 start: `app.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (C:\Program Files\nodejs\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. (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:962:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid btc#1.0.0
15 verbose cwd C:\Users\THOR\Desktop\btc
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
18 verbose node v10.15.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error btc#1.0.0 start: `app.js`
22 error Exit status 1
23 error Failed at the btc#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 ]
12 info lifecycle btc#1.0.0~start: Failed to exec start script
Go to your package.json and add your start script like this:
"scripts": {
"script": "node app.js"
}

Exit status 1 npm-lifecycle\index.js:285:16

0 silly lifecycle stork.spa#1.0.0~build.prod: Args: [ '/d /s /c',
10 silly lifecycle 'gulp build.prod --color --env-config prod --build-type prod --base /cli/ --theme dark' ]
11 silly lifecycle stork.spa#1.0.0~build.prod: Returned: code: 1 signal: null
12 info lifecycle stork.spa#1.0.0~build.prod: Failed to exec build.prod script
13 verbose stack Error: stork.spa#1.0.0 build.prod: `gulp build.prod --color --env-config prod --build-type prod --base /cli/ --theme dark`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid stork.spa#1.0.0
15 verbose cwd C:\dev\JWT\Mvc\StorkCMS\Stork.SPA
16 verbose Windows_NT 10.0.17025
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "build.prod"
18 verbose node v8.9.3
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error stork.spa#1.0.0 build.prod: `gulp build.prod --color --env-config prod --build-type prod --base /cli/ --theme dark`
22 error Exit status 1
23 error Failed at the stork.spa#1.0.0 build.prod script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
and in AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib there is no index.js only spawn.js
If you are using rxjs library, then make sure you change the value of
import { Observable } from 'rxjs/Rx';
to
import { Observable } from 'rxjs/observable';
across your workspace
And then make sure you revert/upgrade your typescript to v 2.3.4 and rxjs to 5.6.0. Do a npm clean cache and build again.
This worked for me. It seems there is some problem in compatibility of rxjs library and typescript versions.
Hope this helps.

Resources