Issue
On my local machine, npm run build
works just fine. On my Docker image launched via Jenkins, I get issues like
Cannot find module: 'file-saver'. Make sure this package is installed.
You can install this package by running: npm install file-saver.
and
FAIL src/core/App.test.js
● Test suite failed to run
Cannot find module 'surface-nets' from 'vtext.js'
On my local machine, I have cleared the npm cache (npm cache clean -f
), removed node_modules/
, and reinstalled (npm i
). I have even used npm update
and the npm-check-updates package to update everything. I installed all peer dependencies. My local copy should be as wiped-clean as the copy within Docker is. In the Jenkinsfile, I put npm list
and it shows surface-nets
and file-saver
and all my other packages. I also put ls node_modules/
and I can see the package folders are there. I have reduced my Dockerfile down to just 1 line: FROM node:current
.
Why is it saying "Cannot find module" when the modules are installed?
Solution
The root cause of this issue is still unknown, but I did find out that the repository was corrupted. I ended up wiping the whole remote repo and git init
-ing a new one, then pushing to that. I assume that corruption contributed to the issue at hand here.
Answered By - nullromo
Answer Checked By - Katrina (JavaFixing Volunteer)