Build is throwing error in one of the instance,Now in my local with the same set up, The image is getting created successfully without any error.
Error Message :
Creating an optimized production build...
Failed to compile.
**TypeScript error in undefined(undefined,undefined):
Cannot find type definition file for '@types/testing-library__cypress'. TS2688**
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ocl-client@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ocl-client@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-06-02T14_21_43_413Z-debug.log
The command '/bin/sh -c npm run build' returned a non-zero code: 1
Resolved the same issue in local by following below steps.
- To get rid of TS2688 Error, Changed the version for "@testing-library/cypress" in both the file package.json & package-lock.json (Ref. https://docs.npmjs.com/files/package-lock.json)
- Run the command npm install
- docker build -t ImageName . It worked as expected...
Observation: I may be misleading here,but in my AWS instance I don't see npm command under root user.
Q. Is npm is specific to user ?
[ec2-user@ip-172-31-23-192 ~]$ npm root
/home/ec2-user/node_modules
[ec2-user@ip-172-31-23-192 ~]$ sudo su
[root@ip-172-31-23-192 ec2-user]# npm root
bash: npm: command not found
I am completely new to node.js , is there anything am I missing here ?, Any lead will be very helpful.