我刚刚安装了一个全新的MacOS Catalina,并且尝试使用ng serve运行我的旧项目,但它告诉我'ng: command not found
'是我通过nodeJS 12.13.1安装了npm 6.12.1的以及安装,并运行'npm install -g @ angular / cli',并且都没有问题,然后在同一项目目录中对package.json中包含的内容运行了npm i命令,我在Google上搜索了一下,并建议使用npm link @angular/cli
也没什么不同
答案 0 :(得分:0)
在运行import React from 'react';
import PropTypes from 'prop-types';
import { useDispatch } from 'react-redux';
import clsx from 'clsx';
import DateFnsUtils from '@date-io/date-fns';
import { MuiPickersUtilsProvider } from '@material-ui/pickers';
import { useTranslation } from 'react-i18next';
import { Form } from 'react-final-form';
import createDecorator from 'final-form-calculate';
import Modal from '../../../components/UI/Modal/Modal.component';
import { defaultStyles } from '../../../commonStyles';
import { salesTaxOperations } from '../../../store/salesTaxes';
import validate from '../../../services/validation';
import Footer from '../../UI/Tab/Footer/Footer.component';
import { labels, schema } from './validationHandler';
import SalesTaxFields from './SalesTaxFields.component';
import styles from './SalesTaxForm.styles';
let taxTypesList = [];
const calculator = createDecorator({
field: 'taxType',
updates: {
taxNo: val => {
const indx = taxTypesList.findIndex(el => el.id === val);
if (indx > -1) {
return taxTypesList[indx].taxNo;
}
},
},
});
const SalesTaxForm = ({ open, record, reloadData, setOpen, taxTypes }) => {
const classes = styles();
const applyDefaultStyle = defaultStyles();
const { t } = useTranslation();
const dispatch = useDispatch();
taxTypesList = taxTypes;
async function saveHandler(data) {
await dispatch(salesTaxOperations.updateSalesTaxData(data));
reloadData();
setOpen(false);
}
const closeHandler = () => {
setOpen(false);
};
return (
<Modal title={t('SALESTAX_EDITOR')} open={open} showBtns={false}>
<Form
onSubmit={saveHandler}
initialValues={record}
decorators={[calculator]}
validate={values => validate(schema, values, labels)}
render={({ form, handleSubmit }) => (
<form onSubmit={handleSubmit}>
<MuiPickersUtilsProvider utils={DateFnsUtils}>
<div
className={clsx(
classes.container,
classes.modalWidth,
classes.modalContainer,
applyDefaultStyle.modalinnergrid
)}
>
<SalesTaxFields
classes={classes}
record={record}
taxTypes={taxTypes}
/>
<Footer
closeHandler={closeHandler}
saveHandler={form.submit}
customStyle={classes.footer}
/>
</div>
</MuiPickersUtilsProvider>
</form>
)}
/>
</Modal>
);
};
SalesTaxForm.propTypes = {
open: PropTypes.bool.isRequired,
record: PropTypes.object.isRequired,
reloadData: PropTypes.func.isRequired,
setOpen: PropTypes.func.isRequired,
taxTypes: PropTypes.array.isRequired,
};
export default SalesTaxForm;
后尝试重启终端
答案 1 :(得分:0)
使用以下命令将npm global modules文件夹添加到您的$PATH
变量中
export PATH="$HOME/.npm-packages/bin:$PATH"