Let's focus on the issue here This is not the place to debate the merits of npm audit or how your CI... 33. create react app missingDeps.some not a function. @ ...
LifeSaverfacebook/create-react-appSolvedcreatereactappHowtoincludebootstrap?build-toolsreactzero-configurationdharmesh-khandelwalpostsatfacebook/create-react-appdharmesh-khandelwal16
Iambuildinganappusingcreate-react-appandbootstrap.ButIamnotabletoimportbootstrapinmyapp.Itriedincludingitinindex.htmllikethis:
butitdoesnotwork.
So,howcanIimportbootstrapinmyapp?Thanks
23AnswersShareOriginal✔️AcceptedAnswerisaklafleur246
@taionanswerhelpedme,butmaybeanyoneareinterestedinabitmoredetailedinstructionsohereitgoes...;)
I'musingReact15.5.4...
npminstall--savebootstrap
addimport'../node_modules/bootstrap/dist/css/bootstrap.min.css';toindex.jsfilesoyouhaveBootstrapworkinginthewholeapp.
addPrimaryinApp.jsandyoushouldbeabletoseeabluebootstrapbutton.
index.js
importReactfrom'react';
importReactDOMfrom'react-dom';
importAppfrom'./components/App';
importregisterServiceWorkerfrom'./registerServiceWorker';
import'../node_modules/bootstrap/dist/css/bootstrap.min.css';
import'./index.css';
ReactDOM.render( ,document.getElementById('root'));
registerServiceWorker();
App.js
importReact,{Component}from'react';
classAppextendsComponent{
render(){
return(
Primary
);
}
}
exportdefaultApp;
OtherAnswers:taion79
FortheCSSitshouldprobablybe
import'bootstrap/dist/css/bootstrap.css'
BTW.
BootstrapshipsbuiltCSSintheirnpmpackage.
RelatedIssues:730createreactappError:EPERM:operationnotpermitted,mkdir'C:\Users\Vaidehi'TypeError:Cannotreadproperty'get'ofundefinedTryinstallingitgloballyfirstusingthecommandnpminstall-gcreate-react-appAndthenyoucan...285createreactappnpxcreate-react-appisnotworkingIsolvedthisusingthefollowingcommandnpmuninstall-gcreate-react-appthennpminstall-gcrea...206createreactappDocumenthowtoaddReactBootstrapHere'showIgotReactBootstrapworkingathttps://github.com/manavsehgal/react-eshop(CreateReact...205createreactappErrornpmtestonMacOsSierraIncasethespecificityhelpsanyoneIran:sudochown-R$(whoami)/usr/localbrewupdatebrewinst...164createreactapp4.0alpha-TypeError:CannotaddpropertynoFallthroughCasesInSwitch,objectisnotextensibleIwasabletosidestepthiserrorbyaddingnoFallthroughCasesInSwitch:truetocompilerOptionsinm...104createreactappUsingthetsconfigfiletoconfigurethealiasdoesnottakeeffectItisdefinitelybadtomodifyuser'scustomtsconfig.jsonwithoutoptions!Ifoundaworkaround:Mo...100createreactappTypeError[ERR_INVALID_ARG_TYPE]IhavethesameissuenowTypeError[ERR_INVALID_ARG_TYPE]:Thepathargumentmustbeoftypestring...95createreactappConsiderimportingSVGsasReactcomponentsThisvideoconvincedmethatthewayweshouldbeusingSVGisinlineThistable...92createreactappTypeError:Cannotassigntoreadonlyproperty'jsx'ofobject'#'PersonallyDescribethebugWhencreatingareact-typescriptappusingnpxcreate-react-app--templa...92createreactappInstallfailedwithNodev.10duetoupath@1.0.4incompatibilitySmallfixIsthisabugreport?Notexactly...82createreactappAfterupdateto4.0linterrorsareblockingtherenderingJustwanttopostsomeextracontextforanyonereading:OriginallyCRAuseditsownconfigforlint...80createreactappCRAv1+HotModuleReload(HMR)+ReduxWithWebpack2(whichCRAnowuses)thisshouldbeenough:It'sbecauseAppislive-boundtoES6imp...79createreactappTypeScript4.1:Couldnotfindadeclarationfileformodule'react/jsx-runtime'FWIWranintothisissueafteraDependabotversionbumptoTypeScript4.1.3andyarnadd@types/rea...79createreactappSystemlimitfornumberoffilewatchersreachedIhavehadthiserrortooDescribethebugnpmstartendswithacrypticerrorduetoexceedingthe...77createreactappErrorwhenusingnew'react-jsx'TypeScripttransformThisisbecauseVSCodetheapphasn'tupdatedtotypescriptv4.1yetwhichhassupportforthenew...76createreactappUsingdotenv.envconfigfilecorrectly@georgelovegrove@zackifyIsyourossierratoo?iamunabletoreproduceitAlsotoaddonemoret...75createreactappUseRelayWecoulddetectifyouhaverelayinpackage.jsonandadditsBabelpluginHi...71createreactappHotReloadstoppedworkingwithReact"^17.0.1"IamnotsureeveryoneishavingthesameproblemFormewhenihavenothingon.envorFAST_REFRESH...68createreactappcreate-react-appstartingerror-Error:Novalidexportsmainfoundfor'\node_modules\colorette'Fixedthisproblembyupgradingnode.jstov14.5i'vehadv13.5andv13.6inmylaptop...67createreactappSharingcomponentsbetweenapps,"create-react-component"Ok@gaearonbasedonyourpreviouscommentsitseemsthatthisissueisprettyripeforfixing...66createreactappPWA/ServiceworkerbreakingproductiondeploymentsForthosewhocomeacrossthisissuehereishowyoushouldbeabletofixitforFirebaseHostingE...57createreactappBuildfails:Couldnotfindplugin"proposal-numeric-separator"⚠️Workaround⚠️Ifyouareusingyarnyoucanaddthistoyourpackage.json:Ifyouareusingnpm...56createreactappCompletionroadmapforreact-scripts@2.0Tosummarizetheexistingchangesandtheaboveproposedchanges:v2FeaturesBabel7Jest23webpac...53createreactapp??Operatorresultsin"UnexpectedToken"errwhenusedinpackageChangingbrowsertargetsfromtosolvedmyissueIthink#8445#8526couldberelated...52createreactappHowtoincludebootstrap?@taionanswerhelpedmebutmaybeanyoneareinterestedinabitmoredetailedinstructionsoherei...46createreactappHowtopreventfailingtocompileonCRAwheneslinterrors?I'vedonethesameinmypackage.jsonlikeso:AndnowIcanruntheappwithnpmstartHoweverwec...46createreactappSupportESLintconfigureordisablingESLint(discussion)@oriSomething@gaearonAddingtothelist:NotbeingabletointegratePrettierwithESLint...46createreactappv3.0.0withNodev12/NPM6.9.0gives"TypeError:fseventsisnotaconstructor"SolvetheissueIsthisabugreport?YesDidyoutryrecoveringyourdependencies?Yes...45createreactappnpmupdatefailsinCRAappafternode-sassThisisanissueinnpmversion7+@petersowaand@SirPryderiDescribethebugAftertheinstallof...45createreactappIsthereawaytoremovesourcemaplineinbuiltassets?GENERATE_SOURCEMAP=falsereact-scriptsbuilddoesn'twork?Similarquestionhere:#1004...45createreactappMinifiedReacterror#152-commentsbeforeJSXIusedthisregexinVSCodetofindthetroublesomecomments:\(\s*\n?\s*//SinceCRA3.4.1Probably...44createreactapp`yarnstart`failswitherrormessageworkedformeafterrunningjustthecommandyarninprojectfolderDescriptionyarnstartfailswith...42createreactappnpmrunbuild,howtoremovewebpacksourcemap?Wecannowdisablesourcemapwith:GENERATE_SOURCEMAP=falsenpmrunbuildhowtoremovewebpacksou...42createreactappCannotfindmodule"jquery"ifanyoneusesjquery3.xpleaseuseimport'jquery/src/jquery';Iamportingoversomeoldcodetha...38createreactappv5Regressionreact-error-overlaybuild-UncaughtReferenceError:processisnotdefinedIseethesameerrorwiththesedependenciesnode:16.10.0npm:7.24.0react-scripts:5.0.0Hotrelo...37createreactappCan'tuseaCRAprojectinsideYarnWorkspacesHiI'vehadthisissuelastmonthIsthisabugreport?YesCanyoualsoreproducetheproblemwith...37createreactappTypeScript4supportThisshouldgetfixedinthenextreleaseasreact-scriptsinmasternowrequiresnewerversions:cr...36createreactappDecoratorisnotsupported!Noyoucandothisjustfine:NotefrommaintainersForpeoplecomingtothisthreadlater—ifyouus...36createreactappnpmstartfailedtostartAppWashelpingsomeonewiththisproblemontheirWindowsboxandcameacrossthefollowingSOarticle...35createreactappDependencyoninsecureversionofbraces(Nodesecurityadvisory786)Let'sfocusontheissuehereThisisnottheplacetodebatethemeritsofnpmauditorhowyourCI...33createreactappmissingDeps.somenotafunction@ashnurThisappearstobefixedintheWebpack4upgradePRwhichisavailableviareact-dev-utils@...32createreactappSyntaxError:super()outsideofclassconstructorDoesline7haveatypo?construtor=>constructorHiIgettingerrorfrommanualonFacebookdocs...31createreactappES-LintRule"import/no-webpack-loader-syntax"pleasedeactivateForpeoplewhomightstumbleonthisissueI'mtryingtouseCRAasastartingPointforhttps://git...31createreactappCSSVariables#130isamassivediscussionsoTLDRHiIhavefoundcreate-react-apptobeawonderfulassettorap...31createreactappvisualstudiocodeeslintsupportHiImaintaintheESLintextensionforVSCodeandgothereduetomicrosoft/vscode-eslint#230...29createreactappCan'tremotedevelopcreate-react-appdueto"InvalidHostHeader"CanyouputyourHOSTinto.envfile?Thenrestartthedevelopmentserver.AtworkIdoallmydevel...28createreactappMakethegeneratedappworkifyouflowcheckitSothereareanumberoftasksthatwehavecreatedinordertosimplifythesetupofFlowincreate...28createreactappSupportabsolutepathswithpackages/folderTheproblemwe'retryingtosolveis:import'path/to/banana.js'insteadofthebrittleimport'../....28createreactapp80%ofdeprecationsinconsoleareduetoreact-scriptsToprovidesometrackingofeachwarningformyselfandothers:Therequest-promise-nativeandreque...26createreactappAllowconfiguringreportersforJestYoushouldbeabletopassitasacommandlineoptionSinceitdoesn'tseemtomakesensefornon-C...LifeSaverPrivacyPolicyDisclaimer