I'm trying to install mocha on my windows 10 but I'm getting this error on the terminal
$npm install mocha#3.0.0 --save-dev
npm ERR! Unexpected end of input at 1:19983
npm ERR! a":"./bin/_mocha"},"directories":{},"dist":{"shasum":"653712e9852cce4
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\NS\AppData\Roaming\npm-cache\_logs\2017-06-24T21_47_36_363Z-debug.log
this is the log file content
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\NS\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'mocha#3.0.0',
1 verbose cli '--save-dev' ]
2 info using npm#5.0.2
3 info using node#v6.10.2
4 silly install loadCurrentTree
5 silly install readLocalPackageData
6 http fetch GET 200 https://registry.npmjs.org/mocha 34ms (from cache)
7 silly fetchPackageMetaData error for mocha#3.0.0 Unexpected end of input at 1:19983
7 silly fetchPackageMetaData a":"./bin/_mocha"},"directories":{},"dist":{"shasum":"653712e9852cce4
7 silly fetchPackageMetaData ^
8 verbose stack SyntaxError: Unexpected end of input at 1:19983
8 verbose stack a":"./bin/_mocha"},"directories":{},"dist":{"shasum":"653712e9852cce4
8 verbose stack ^
8 verbose stack at SyntaxError (native)
8 verbose stack at Object.parseJSON (C:\Users\NS\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\node_modules\json-parse-helpfulerror\node_modules\jju\lib\parse.js:745:13)
8 verbose stack at parse (C:\Users\NS\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\node_modules\json-parse-helpfulerror\index.js:10:13)
8 verbose stack at consumeBody.call.then.buffer (C:\Users\NS\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\body.js:96:50)
8 verbose stack at process._tickCallback (internal/process/next_tick.js:109:7)
9 verbose cwd C:\Users\NS\node-test
10 verbose Windows_NT 10.0.15063
11 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\NS\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "mocha#3.0.0" "--save-dev"
12 verbose node v6.10.2
13 verbose npm v5.0.2
14 error Unexpected end of input at 1:19983
14 error a":"./bin/_mocha"},"directories":{},"dist":{"shasum":"653712e9852cce4
14 error ^
15 verbose exit [ 1, true ]
if you are using the latest version of node
try downgrading to the LTS version
//
sudo npm install n -g
sudo n lts
if you are using it in local then use command "npm cache clean --force" to clear cache. Then run your command it will work
Related
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 'install',
1 verbose cli 'react-bootstrap',
1 verbose cli 'bootstrap'
1 verbose cli ]
2 info using npm#6.14.4
3 info using node#v12.17.0
4 verbose npm-session 4004d1d4d37ac517
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 200 https://registry.npmjs.org/react-bootstrap 521ms
8 silly fetchPackageMetaData error for react-bootstrap#latest Unexpected end of JSON input while parsing near '...,"requirejs":"~2.1.9"'
9 http fetch GET 200 https://registry.npmjs.org/bootstrap 521ms
10 silly fetchPackageMetaData error for bootstrap#latest Unexpected end of JSON input while parsing near '...7bc2df7ec608869c9c8",'
11 timing stage:rollbackFailedOptional Completed in 0ms
12 timing stage:runTopLevelLifecycles Completed in 3560ms
13 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...,"requirejs":"~2.1.9"'
13 verbose stack at JSON.parse (<anonymous>)
13 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
13 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50
13 verbose stack at processTicksAndRejections (internal/process/task_queues.js:97:5)
14 verbose cwd D:\Talk2Tutor\material-kit-react-master
15 verbose Windows_NT 10.0.17134
16 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "react-bootstrap" "bootstrap"
17 verbose node v12.17.0
18 verbose npm v6.14.4
19 error Unexpected end of JSON input while parsing near '...,"requirejs":"~2.1.9"'
20 verbose exit [ 1, true ]
I got above error while running npm i react-bootstrap bootstrap. After the error occurred, I tried npm cache clean --force but it didn't resolve my problem. Then I reinstalled node and tried to install dependencies but I still get an error and installation is failed. Any one fixed this error. I tried all the things mentioned in the related question. But it didn't solve my problem. I use node v12.17.0 and npm 6.14.4.
I tried by executing command npm cache clean --force and then executed the command that caused this error and it worked fine.
Upgrade npm using npm-windows-upgrade solved the issue.
After running the command npm cache clean --force . You need to remove the package-lock.json file. This worked for me.
Popper.js is required if you're using Bootstrap JS. Check the docs
Firstly I installed the latest version of angular cli. Then when I tried to downgrade to 7.3.3 there was an error: 400 Bad Request - GET https://github.com/. Also I can not install anything with npm install like node-sass etc. So I unistalled nodejs and tried to install again angular cli, but the same error appeared. Maybe I have changed any configuration.
CMD
C:\Windows\system32>node -v
v12.17.0
C:\Windows\system32>npm install -g #angular/cli
npm ERR! code E400
npm ERR! 400 Bad Request - GET https://github.com/
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\XXXX\AppData\Roaming\npm-cache\_logs\2020-06-01T10_49_37_560Z-debug.log
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 'install',
1 verbose cli '-g',
1 verbose cli '#angular/cli'
1 verbose cli ]
2 info using npm#6.14.4
3 info using node#v12.17.0
4 verbose npm-session bc2383db262e35f5
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 400 https://github.com/ 506ms
8 silly fetchPackageMetaData error for #angular/cli#latest 400 Bad Request - GET https://github.com/
9 timing stage:rollbackFailedOptional Completed in 1ms
10 timing stage:runTopLevelLifecycles Completed in 543ms
11 verbose stack Error: 400 Bad Request - GET https://github.com/
11 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-fetch\check-response.js:104:15
11 verbose stack at processTicksAndRejections (internal/process/task_queues.js:97:5)
12 verbose statusCode 400
13 verbose pkgid #angular/cli#latest
14 verbose cwd C:\Windows\system32
15 verbose Windows_NT 10.0.17763
16 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "#angular/cli"
17 verbose node v12.17.0
18 verbose npm v6.14.4
19 error code E400
20 error 400 Bad Request - GET https://github.com/
21 verbose exit [ 1, true ]
1.>Go to your this location
C:\Users\{your user name or ID}
2.> open .npmrc & Remove all content from .npmrc file.
3.>reopen your new command prompt
4.>again run the code , will work.
you must enable developer mode first in windows 10
setting
update & security
for developers
and enable developer mode
I'am trying to install react-native-cli but getting error
npm install -g react-native-cli
getting this error
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'react-native-cli' ]
2 info using npm#6.4.1
3 info using node#v10.15.0
4 verbose npm-session 72c72ae6cf674a04
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 http://registry.npmjs.org/react-native-cli 247ms
8 silly fetchPackageMetaData error for react-native-cli#latest Unexpected token < in JSON at position 0 while parsing near '<HTML><HEAD>
8 silly fetchPackageMetaData <meta h...'
9 timing stage:rollbackFailedOptional Completed in 1ms
10 timing stage:runTopLevelLifecycles Completed in 568ms
11 verbose stack SyntaxError: Unexpected token < in JSON at position 0 while parsing near '<HTML><HEAD>
11 verbose stack <meta h...'
11 verbose stack at JSON.parse (<anonymous>)
11 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
11 verbose stack at consumeBody.call.then.buffer (C:\Program Files\nodejs\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 C:\Users\Basva
13 verbose Windows_NT 10.0.17134
14 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "react-native-cli"
15 verbose node v10.15.0
16 verbose npm v6.4.1
17 error Unexpected token < in JSON at position 0 while parsing near '<HTML><HEAD>
17 error <meta h...'
18 verbose exit [ 1, true ]
What may be the wrong..!!!?
Make sure whether your npm package correctly install.I solved this problem following below step.Try it..
npm i -g npm
npm cache clean
npm update
npm i
I think https://facebook.github.io/react-native/docs/getting-started.html is more useful for your.
When I try installing Typescript with npm, I get an error:
npm ERR! Unexpected end of JSON input while parsing near '...latest","mocha":"late'
This is the content of the log file:
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 'i',
1 verbose cli 'typescript',
1 verbose cli '--save-dev' ]
2 info using npm#6.0.1
3 info using node#v10.0.0
4 verbose npm-session d4b7b23a6f27323f
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 200 https://registry.npmjs.org/typescript 28ms (from cache)
8 silly fetchPackageMetaData error for typescript#latest Unexpected end of JSON input while parsing near '...latest","mocha":"late'
9 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...latest","mocha":"late'
9 verbose stack at JSON.parse (<anonymous>)
9 verbose stack at parseJson (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/node_modules/json-parse-better-errors/index.js:7:17)
9 verbose stack at consumeBody.call.then.buffer (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/body.js:96:50)
9 verbose stack at process._tickCallback (internal/process/next_tick.js:178:7)
10 verbose cwd /Users/Bayo/Documents/Personal/Learning/tstest
11 verbose Darwin 16.7.0
12 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "typescript" "--save-dev"
13 verbose node v10.0.0
14 verbose npm v6.0.1
15 error Unexpected end of JSON input while parsing near '...latest","mocha":"late'
16 verbose exit [ 1, true ]
My current npm version is 6.0.1
My current node version is 10.0.0
Error Log info :
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '--save-dev',
1 verbose cli 'webpack' ]
2 info using npm#5.0.1
3 info using node#v6.10.2
4 silly install loadCurrentTree
5 silly install readLocalPackageData
6 http fetch GET 400 https://registry.npmjs.org/webpack 238ms
7 silly fetchPackageMetaData error for webpack#latest 400 Bad Request ( The data is invalid. ): webpack#latest
8 verbose stack Error: 400 Bad Request ( The data is invalid. ): webpack#latest
8 verbose stack at fetch.then.res (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\lib\fetchers\registry\fetch.js:36:19)
8 verbose stack at tryCatcher (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
8 verbose stack at Promise._settlePromiseFromHandler (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31)
8 verbose stack at Promise._settlePromise (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
8 verbose stack at Promise._settlePromise0 (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
8 verbose stack at Promise._settlePromises (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
8 verbose stack at Async._drainQueue (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\async.js:133:16)
8 verbose stack at Async._drainQueues (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\async.js:143:10)
8 verbose stack at Immediate.Async.drainQueues (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\async.js:17:14)
8 verbose stack at runCallback (timers.js:666:20)
8 verbose stack at tryOnImmediate (timers.js:639:5)
8 verbose stack at processImmediate [as _immediateCallback] (timers.js:611:5)
9 verbose cwd D:\2017\ReactJSProject
10 verbose Windows_NT 6.1.7601
11 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "--save-dev" "webpack"
12 verbose node v6.10.2
13 verbose npm v5.0.1
14 error code E400
15 error 400 Bad Request ( The data is invalid. ): webpack#latest
16 verbose exit [ 1, true ]
Try the Below :
Option 1
Open Command prompt as admin
npm uninstall -g webpack#latest
npm cache clean
npm config set strict-ssl false
npm install -g webpack#latest
OR :
Option 2
Open Command prompt as admin
npm uninstall -g webpack#latest
npm cache clean
npm config set proxy="http://proxy.example.com:8080"
npm config set https-proxy="http://proxy.example.com:8080"
npm config set strict-ssl false
npm install -g webpack#latest
If you get the error reason: write EPROTO try,
npm config set proxy="http://proxy.example.com:8080"
npm config set https-proxy="http://proxy.example.com:8080"
Follow Option 2
If all the above fails try to install the latest stable version of node & npm.