uglify Error: Cannot find module 'optimist'

299 views Asked by At

I am going to uglify index.js file. But it throws this error: Cannot find module 'optimist'.

I have installed optimist: npm install optimist but it doesn't work. Anyone can help?

uglifyjs index.js

module.js:550
    throw err;
    ^

Error: Cannot find module 'optimist'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/lib/nodejs/uglify-js/bin/uglifyjs:8:16)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
1

There are 1 answers

1
Prakash Harvani On

try this command,

npm i optimist --save

If It does not work then try this,

Delete node_modules folder & package-lock.json &then try this command,

npm i --save