Answer a question

Getting below error while "npm run build" on server.On local machine working fine. Getting 500 response on server
node 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.

Answers

Try npm install --save has-flag. It looks like supports-color is requiring has-flag to be installed but it isn't. If you need to install any other packages you can just type npm install.

Logo

React社区为您提供最前沿的新闻资讯和知识内容

更多推荐