如何从外部 src 目录导入module?
./src/App.js
Module not found: Can't resolve 'material-ui' in '/Users/suvo/GitHub/portfolio/src'
根据react-material-icons
页面,我应该按如下方式导入:
import mui from 'material-ui';
错误很奇怪。我就import $ from 'jquery';
在旁边import mui...
,它工作正常。更重要的是,如果我创建一个新项目并添加 react-material-icons,npm 将不会启动,并显示错误:
> myapp@0.1.0 start /Users/suvo/GitHub/myapp
> react-scripts start
sh: react-scripts: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! myapp@0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the myapp@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/suvo/.npm/_logs/2017-09-11T11_40_15_791Z-debug.log