Survey platform start
First run:
npm update
Second run:
ng update
Third run: (It will update all the mismatching packages)
npm update --all --force
-
先是报”node-sass”不存在的错误
-
安装“node-sass”之后,又报错版本不兼容Error: Node Sass version 8.0.0 is incompatible with ^4.0.0.
我的package.json 依赖的是 "node-sass": "^4.12.0",
然后尝试安装 node-sass 4版本 发现安装失败
最后通过百度及 node-sass npm网站 发现 高版本node 安装不了 低版本sass
且 高版本node 对低版本 node-sass不支持
最后 解决方法
node.js 降级
image.png -
node降级之后,npm也需要降级
- ERROR: npm v9.4.1 is known not to run on Node.js v12.22.12. You'll need toupgrade to a newer Node.js version in order to use this version of npm. Thisversion of npm supports the following node versions:
^14.17.0 || ^16.13.0 ||>=18.0.0
. You can find the latest version at https://nodejs.org/.
node 12对应的npm 版本是npm6.13.4
node 14对应的npm 版本是npm8
- npm降级之后,安装“node-sass”
npm ERR! fatal: unable to access 'https://github.com/eligrey/FileSaver.js.git/': Empty reply from server
npm ERR!
npm ERR! A complete log of this run can be found in:
npm install gyp
failed with exit code:
命令如下:
xcode-select --install
sudo xcode-select --switch /Library/Developer/CommandLineTools
sudo npm explore npm -g -- npm install node-gyp@latest
作者:黎明的叶子
链接:https://www.jianshu.com/p/21b606112f09
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
ERROR in node_modules/pptxgenjs/types/index.d.ts(842,31): error TS1110: Type expected.
"pptxgenjs": "^3.11.0",
重装pptxgenjs:
升级tsc版本:
image.png
升级typescript之后报这个错误
ERROR in The Angular Compiler requires TypeScript >=3.1.1 and <3.3.0 but 4.9.5 was found instead.
降回去到3.2.4
删掉pptxgenjs包:
ERROR in node_modules/@types/lodash/ts4.2/common/lang.d.ts(578,74): error TS2677: A type predicate's type must be assignable to its parameter's type.
Type 'EmptyObjectOf<T>' is not assignable to type 'T'.
Type 'EmptyObject<T>' is not assignable to type 'T'.
src/app/report-management/components/export-modal/export-modal.component.ts(7,21): error TS2307: Cannot find module 'pptxgenjs'.
src/app/shared/components/filter-multi-select/filter-multi-select.component.ts(25,5): error TS2554: Expected 5 arguments, but got 3.
src/app/shared/components/filter-multi-select/filter-multi-select.component.ts(34,12): error TS2339: Property 'addScrollEventListener' does not exist on type 'FilterMultiSelectComponent'
然后这些错误的包都卸载按照原来package-lock.json里的版本重新安装就可以了。
网友评论