代码之家  ›  专栏  ›  技术社区  ›  Alisson Gomes

使用Angular CLI 6运行ng serve Angular 4,有可能吗?

  •  0
  • Alisson Gomes  · 技术社区  · 7 年前

    我和Angular 4有个项目。

    我更新了命令行:

    Angular CLI: 6.1.5
    Node: 10.9.0
    OS: win32 x64
    

    ng serve 我和Angular 4的项目?

    文件 angular.json 角4不存在。

    谢谢你。

    Local workspace file ('angular.json') could not be found.
    Error: Local workspace file ('angular.json') could not be found.
    
    3 回复  |  直到 7 年前
        1
  •  1
  •   Jakub Szumiato    7 年前

    AngularCLI紧跟角度释放。尤其是像这样的开关 angular.json 我怀疑有什么有效的方法来处理这个案子。 如果升级项目是不可能的,我建议降级的CLI。

    请注意,即使 https://update.angular.io/ 不建议跨多个主要版本移动项目:

    但是,如果你选择升级一个主要版本,有两件事要做来处理这个问题。无论如何,这是一个困难的话题。如果您使用的是旧版应用程序,无法轻松升级该应用程序,我建议您选择降级。

        2
  •  1
  •   Vlad Melnichenko    7 年前

    我建议您在PC上安装最新版本的AngularCLI,并在计算机中指定其他版本 package.json . 每次启动时,您都会收到一条警告,告诉您“您的AngularCLI版本高于中的版本”包.json. 将使用本地版本而不是全局版本。“。这只是一个信息,什么也不做。

        3
  •  0
  •   Alisson Gomes    7 年前

    谢谢你的回答。

    因此,在dev环境中,我可以使用以下命令运行 npm install ng serve . 之后 这个 Angular CLI: 6.1.1 更改为 @angular/cli: 1.1.1 .

    ngupgrade $] npm install
    npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
    npm WARN deprecated hoek@2.16.3: The major version is no longer supported. Please update to 4.x or newer
    
    > node-sass@4.9.3 install C:\dev\wks\wks-lab\ngUpgrade-without-preparation\node_modules\node-sass
    > node scripts/install.js
    
    Cached binary found at C:\Users\alisson\AppData\Roaming\npm-cache\node-sass\4.9.3\win32-x64-64_binding.node
    
    > node-sass@4.9.3 postinstall C:\dev\wks\wks-lab\ngUpgrade-without-preparation\node_modules\node-sass
    > node scripts/build.js
    
    Binary found at C:\dev\wks\wks-lab\ngUpgrade-without-preparation\node_modules\node-sass\vendor\win32-x64-64\binding.node
    Testing binary
    Binary is fine
    npm notice created a lockfile as package-lock.json. You should commit this file.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","ar
    ch":"x64"})
    
    added 1094 packages from 1162 contributors and audited 5834 packages in 381.117s
    found 15 vulnerabilities (9 low, 6 high)
      run `npm audit fix` to fix them, or `npm audit` for details
    
    ngupgrade $]ng -v
        _                      _                 ____ _     ___
       / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
      / ? \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
     / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
    /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                   |___/
    @angular/cli: 1.1.1
    node: 10.9.0
    os: win32 x64
    @angular/animations: 4.4.7
    @angular/common: 4.4.7
    @angular/compiler: 4.4.7
    @angular/core: 4.4.7
    @angular/forms: 4.4.7
    @angular/http: 4.4.7
    @angular/platform-browser: 4.4.7
    @angular/platform-browser-dynamic: 4.4.7
    @angular/router: 4.4.7
    @angular/upgrade: 4.4.7
    @angular/cli: 1.1.1
    @angular/compiler-cli: 4.4.7
    @angular/language-service: 4.4.7
    
    ngupgrade $]ng serve
    ** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200 **
    Hash: 6297789187cf54cae976
    Time: 16458ms
    chunk    {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 195 kB {4} [initial] [rendered]
    chunk    {1} main.bundle.js, main.bundle.js.map (main) 10.7 kB {3} [initial] [rendered]
    chunk    {2} styles.bundle.js, styles.bundle.js.map (styles) 10.5 kB {4} [initial] [rendered]
    chunk    {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.59 MB [initial] [rendered]
    chunk    {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
    webpack: Compiled successfully.
    ^CTerminate batch job (Y/N)? Y
    
    ngupgrade $]