Cannot find module 'has-flag'

The error below is when running npm run build on the server. It works fine on the local machine. Getting 500 response on
node server version: 8.0
npm version: 5.0.3

    Error: Cannot find module 'has-flag'  
    at Function.Module._resolveFilename (module.js:485:15)  
    at Function.Module._load (module.js:437:25)  
    at Module.require (module.js:513:17)  
    at require (internal/module.js:11:18)  
    at Object.<anonymous>  
 (/usr/share/../../../node_modules/postcss/node_modules/supports-color/index.js:2:15)  
    at Module._compile (module.js:569:30)  
    at Object.Module._extensions..js (module.js:580:10)  
    at Module.load (module.js:503:32)  
    at tryModuleLoad (module.js:466:12)  
    at Function.Module._load (module.js:458:3)  
npm ERR! code ELIFECYCLE  
npm ERR! errno 1  
npm ERR! ***@0.1.0 build: `react-scripts build`  
npm ERR! Exit status 1  
npm ERR!   
npm ERR! Failed at the ***@0.1.0 build script.  
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
+4
source share
1 answer

Give it a try npm install --save has-flag. It seems to supports-colorrequire installation has-flag, but it is not. If you need to install any other packages, you can simply enter npm install.

+3
source

Source: https://habr.com/ru/post/1681673/


All Articles