rrdelaney / reason-scripts

:beginner: Create a ReasonML and React development environment
MIT License
628 stars 58 forks source link

Need to run `npm install` after create-react-app has run when using npm #66

Closed m90 closed 6 years ago

m90 commented 6 years ago

When trying to do what the README says using npm:

$ npm install -g bs-platform
$ npx create-react-app <app-name> --scripts-version reason-scripts
$ cd <app-name>
$ npm start

I got the following error:

Failed to compile
./node_modules/reason-react/src/ReactDOMRe.js
Module not found: Can't resolve 'bs-platform/lib/es6/caml_builtin_exceptions.js' in '/home/frederik/projects/reason-test/node_modules/reason-react/src'
This error occurred during the build time and cannot be dismissed.

This seems to be due to the fact that create-react-app does not install all required dependencies as the following will work as expected:

$ npm install -g bs-platform
$ npx create-react-app <app-name> --scripts-version reason-scripts
$ cd <app-name>
$ npm install
$ npm start

Is this a bug in the project setup or is it expected to be done like this and the missing npm install needs to be added to the README?

For the record this is my setup:

➜  reason-test npm -v
6.1.0
➜  reason-test node -v
v8.11.3
➜  reason-test npm list -g bs-platform
/home/frederik/.npm-global/lib
└── bs-platform@3.1.5 
rrdelaney commented 6 years ago

Hi @m90, thanks for filing this issue! We're hard at work on a new version of reason-scripts trying to fix this issue once and for all, and in the meantime you can try out the beta version that fixes this by creating your app with

npm create-react-app <app-name> --scripts-version reason-scripts@next

In the meantime, we recommend you check out the Help, Tips, and Tricks, where we have a guide on what to do if your app isn't building right after creating it.

m90 commented 6 years ago

Using reason-scripts@next works as expected, thanks. Looking forward to 1.0.0 :tada: