0

I want to install serverless as global. npm install -g serverless

but when the installation process, I got the same error like this

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/serverless/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! Unexpected end of JSON input while parsing near '...","querystring":"^0.2'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/fathisiddiqi/.npm/_logs/2020-09-17T07_24_40_981Z-debug.log

I have clean npm cache with npm cache clean --force I tried again, and got another errors like this

npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/lodash (over 30000ms)

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/fathisiddiqi/.npm/_logs/2020-09-17T07_26_46_746Z-debug.log

Finally, i tried to install serverless again. but still got message

npm ERR! Unexpected end of JSON input while parsing near '...TTOgEjCFo9YXvGwfWu94f'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/fathisiddiqi/.npm/_logs/2020-09-17T07_30_56_320Z-debug.log

Please help me. Thanks!

1
  • what version of npm you are using? Commented Sep 17, 2020 at 8:12

2 Answers 2

1

first

npm cache clean --force

second

To update to a new major version all the packages, install the npm-check-updates package globally:

npm install -g npm-check-updates

then run it:

ncu -u

This will upgrade all the version hints in the package.json file, to dependencies and devDependencies, so npm can install the new major version.

You are now ready to run the update:

npm update

then install your package

Sign up to request clarification or add additional context in comments.

2 Comments

I just clean cache and uninstall these package first after that reinstall again.
did my method work for you?if it was helpful accept it as your solution so that it may help others in future :)
0

please uninstall your global serverless and clear cache

npm uninstall -g serverless

and

npm cache clear --force

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.