Module not found
Closed this issue · 2 comments
Excuse me, I have something problem:
I clone this repo and running npm install
,
and switch to example/simple
this example, and I running npm install
.
after running npm install
, I execute npm start
, have something error:
Module not found: Error Cannot resolve module 'react'
then, I open package.json
add react
into dependencies
,
save and run npm start
it can work.
Why have this error message? 😧
Thank you.
You should execute npm run build
at project root directory first if you clone repo from github.
https://github.com/chentsulin/sweetalert-react/blob/master/package.json#L15-L18
Line 15: use babel
to compile es6, jsx syntax
Line 16: use webpack
to build umd module (which can run in global, amd, commonjs environments)
Line 17: use webpack
to build minified umd module
Line 18: do 15, 16, and 17
Maybe I should add a npm script like this:
"postinstall": "node -e \"require('fs').stat('lib', function (e, s) { process.exit(e || !s.isDirectory() ? 1 : 0) })\" || npm run build",
And then it will build after npm install