1.使用nvm下载14.17.5版本node,发现没有npm。
报错:bash: npm: command not found
2.删除node_modules和package-lock.json,重新安装发现报错
npm ERR! git@github.com: Permission denied (publickey). npm ERR! fatal: Could not read from remote repository.
解决方法:在 github 增加 SSH
3. npm安装canvas时报错
npm ERR! Failed at the canvas@2.0.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
解决方法:使用淘宝镜像npm install canvas --canvas_binary_host_mirror=CNPM Binaries Mirror
网上搜索到的链接都没有用,最后是在这里找到的。参考链接:https://gist.github.com/long-woo/ce94ec063aa392589b9996bfeaf27971
4. 报错:Syntax Error: Error: ENOENT: no such file or directory, scandir 'D:\FTL-Workspace\project\tms-web\node_modules\node-sass\vendor'
解决方法:npm rebuild node-sass
5.提示:TypeError: token.type.endsWith is not a function
解决方法:移除babel-eslint
添加 npm install eslint @babel/core @babel/eslint-parser --save-dev
并且将.eslinttrc.js文件中的
parserOptions: { // babel-eslint 改为 @babel/eslint-parser parser: '@babel/eslint-parser' }
最后重启项目