迁移到Angular 8后,Router没有给出导出的成员错误

时间:2019-11-13 09:43:34

标签: angular angular8 tslint

我刚刚迁移到Angular 8,开始出现错误

Module '"../../node_modules/@angular/router/router"' has no exported member 'NoPreloading'.

此错误来自以下行:

import { NoPreloading, RouterModule, Routes } from '@angular/router';

@angular/router的所有成员都会发生这种情况。我究竟做错了什么?尽管出现错误,一切仍然可以正常工作。

2 个答案:

答案 0 :(得分:1)

您是否尝试通过运行NPM安装或yarn安装删除node_modules文件夹并重新安装它们?通常,这些向更高版本的迁移会导致程序包之间的不一致。

答案 1 :(得分:1)

这可能是由于迁移后旧项目中的某些节点模块丢失。这是要遵循的步骤,

  1. 删除您的 package-lock.json 文件
  2. 从项目的工作目录中删除 node_modules 文件夹
  3. 运行62 INFO: PyInstaller: 3.5 62 INFO: Python: 3.7.5 62 INFO: Platform: Windows-10-10.0.17763-SP0 62 INFO: wrote C:\Users\User\Desktop\Project\main.spec 62 INFO: UPX is not available. 62 INFO: Extending PYTHONPATH with paths ['C:\\Users\\User\\Desktop\\Project', 'C:\\Users\\User\\Desktop\\Project'] 62 INFO: checking Analysis 78 INFO: Building Analysis because Analysis-00.toc is non existent 78 INFO: Initializing module dependency graph... 78 INFO: Initializing module graph hooks... 78 INFO: Analyzing base_library.zip ... 2124 INFO: running Analysis Analysis-00.toc 2124 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable required by c:\users\user\appdata\local\programs\python\python37\python.exe 3900 INFO: Caching module hooks... 3900 INFO: Analyzing C:\Users\User\Desktop\Project\main.py 4306 INFO: Processing pre-find module path hook distutils 5040 INFO: Processing pre-find module path hook site 5040 INFO: site: retargeting to fake-dir 'c:\\users\\user\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\PyInstaller\\fake-modules' 5925 INFO: Processing pre-safe import module hook setuptools.extern.six.moves 7668 INFO: Loading module hooks... 7668 INFO: Loading module hook "hook-distutils.py"... 7671 INFO: Loading module hook "hook-encodings.py"... 7743 INFO: Loading module hook "hook-lib2to3.py"... 7747 INFO: Loading module hook "hook-numpy.core.py"... 7845 INFO: Loading module hook "hook-numpy.py"... 7846 INFO: Loading module hook "hook-pkg_resources.py"... 8092 INFO: Processing pre-safe import module hook win32com Traceback (most recent call last): File "<string>", line 2, in <module> ModuleNotFoundError: No module named 'win32com' 8150 INFO: Processing pre-safe import module hook win32com Traceback (most recent call last): File "<string>", line 2, in <module> ModuleNotFoundError: No module named 'win32com' 8327 INFO: Loading module hook "hook-pydoc.py"... 8328 INFO: Loading module hook "hook-setuptools.py"... 8742 INFO: Loading module hook "hook-sysconfig.py"... 8742 INFO: Loading module hook "hook-xml.dom.domreg.py"... 8742 INFO: Loading module hook "hook-xml.py"... 8742 INFO: Loading module hook "hook-_tkinter.py"... 9133 INFO: checking Tree 9133 INFO: Building Tree because Tree-00.toc is non existent 9148 INFO: Building Tree Tree-00.toc 9211 INFO: checking Tree 9211 INFO: Building Tree because Tree-01.toc is non existent 9211 INFO: Building Tree Tree-01.toc 9258 INFO: Looking for ctypes DLLs 9273 INFO: Analyzing run-time hooks ... 9273 INFO: Including run-time hook 'pyi_rth_pkgres.py' 9289 INFO: Including run-time hook 'pyi_rth_multiprocessing.py' 9289 INFO: Including run-time hook 'pyi_rth__tkinter.py' 9289 INFO: Looking for dynamic libraries 18180 INFO: Looking for eggs 18180 INFO: Using Python library c:\users\user\appdata\local\programs\python\python37\python37.dll 18180 INFO: Found binding redirects: [] 18180 INFO: Warnings written to C:\Users\User\Desktop\Project\build\main\warn-main.txt 18445 INFO: Graph cross-reference written to C:\Users\User\Desktop\Project\build\main\xref-main.html 18492 INFO: checking PYZ 18492 INFO: Building PYZ because PYZ-00.toc is non existent 18492 INFO: Building PYZ (ZlibArchive) C:\Users\User\Desktop\Project\build\main\PYZ-00.pyz 19259 INFO: Building PYZ (ZlibArchive) C:\Users\User\Desktop\Project\build\main\PYZ-00.pyz completed successfully. 19274 INFO: checking PKG 19274 INFO: Building PKG because PKG-00.toc is non existent 19274 INFO: Building PKG (CArchive) PKG-00.pkg 19290 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully. 19290 INFO: Bootloader c:\users\user\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\bootloader\Windows-64bit\runw.exe 19290 INFO: checking EXE 19290 INFO: Building EXE because EXE-00.toc is non existent 19290 INFO: Building EXE from EXE-00.toc 19290 INFO: Appending archive to EXE C:\Users\User\Desktop\Project\build\main\main.exe 19306 INFO: Building EXE from EXE-00.toc completed successfully. 19306 INFO: checking COLLECT 19306 INFO: Building COLLECT because COLLECT-00.toc is non existent 19306 INFO: Building COLLECT COLLECT-00.toc 22581 INFO: Building COLLECT COLLECT-00.toc completed successfully.