Working on the same project as a colleague, when performing npm install I have the following problem, although none of my colleagues have the same problem. We all use docker
I have a Windows 10 with docker and I use the following workaround. Into the docker, in my home I create a directory, for example:
/home/my_project/node_modules.
Them in my mapped directory within windows and linux(into the docker) I make a symbolic link within the directory I created before an "node_modules". Something like
ln -s src dest
ln -s /home/my_project/node_modules /var/www/html/my_project/node_modules
Them, into my project I call the
npm install
With this solution, the node-sass install with no problem.
I'm not an expert but I think the problem was the mapping within the windows and linux and the way that npm installs with links this package.
Best regards
Since it fails on readFileSync
/openSync
, this can be related to file synchronization issues between Docker and your host (Windows). It fails in /var/www
which is most likely the folder which you're sharing as a volume inside the Docker container.
As for the workaround, you can exclude a node_modules sub-folder and make it persistent.
If you're using docker-compose.yml
, mount a persistent docker volume in place of your local node_modules
directory, e.g.
...
volumes:
- .:/var/www
- node_modules:/var/www/node_modules
See: Add a volume to Docker, but exclude a sub-folder
Related GitHub issue: EINVAL: invalid argument, open 'node-sass/package.json'.
Check also node-sass's troubleshooting page.
Related question: npm install on laradock not working.
npm install
is falling while installing node-sass
. I have faced this issue personally many times and npm rebuild node-sass
command always helps me out.
Hope, it does for you too :)