Fathi
Fathi

Reputation: 85

Error when installing serverless on Linuxmint 20.1

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!

Upvotes: 0

Views: 125

Answers (2)

Jatin Mehrotra
Jatin Mehrotra

Reputation: 11608

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

Upvotes: 1

Fathi
Fathi

Reputation: 85

please uninstall your global serverless and clear cache

npm uninstall -g serverless

and

npm cache clear --force

Upvotes: 0

Related Questions