React-datepicker: Npm install failure on Ubuntu EC2 instance

Created on 29 Mar 2019  路  1Comment  路  Source: Hacker0x01/react-datepicker

Expected behavior

NPM install succeeds

Actual behavior

NPM install fails

Steps to reproduce

Deploying a react project with date-fns dependency on Ubuntu EC2 instance throws an exception:

root@ip-172-31-55-213:~/www/~proj/web# npm install react-datepicker

> [email protected] postinstall /root/www/~proj/web/node_modules/react-datepicker/node_modules/date-fns
> node ./docs/printV2Notice.js

module.js:549
    throw err;
    ^

Error: Cannot find module '/root/www/~proj/web/node_modules/react-datepicker/node_modules/date-fns/docs/printV2Notice.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3

Most helpful comment

I have:

rm -rf node_modules
Redo npm install
uninstall and reinstall react-datepicker

However I did manage to fix it, I had to sudo npm install in order to get passed it. However, this isn't a problem in any other dependency I have in any other projects.

>All comments

I have:

rm -rf node_modules
Redo npm install
uninstall and reinstall react-datepicker

However I did manage to fix it, I had to sudo npm install in order to get passed it. However, this isn't a problem in any other dependency I have in any other projects.

Was this page helpful?
0 / 5 - 0 ratings