Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将angular cli迁移到@angular/cli问题_Javascript_Node.js_Angular_Angular Cli - Fatal编程技术网

Javascript 将angular cli迁移到@angular/cli问题

Javascript 将angular cli迁移到@angular/cli问题,javascript,node.js,angular,angular-cli,Javascript,Node.js,Angular,Angular Cli,我有一个项目,它使用MEAN堆栈来构建一个简单的身份验证应用程序。当我试图通过输入angular src目录并从终端运行ng serve为前端服务时 $ ng serve Unable to find "@angular/cli" in devDependencies. The package "angular-cli" has been deprecated and renamed to "@angular/cli". Please take the following steps to

我有一个项目,它使用
MEAN
堆栈来构建一个简单的身份验证应用程序。当我试图通过输入
angular src
目录并从终端运行
ng serve
为前端服务时

$ ng serve
Unable to find "@angular/cli" in devDependencies.

The package "angular-cli" has been deprecated and renamed to "@angular/cli".

Please take the following steps to avoid issues:
"npm uninstall --save-dev angular-cli"
"npm install --save-dev @angular/cli@latest"

The "@angular/compiler-cli" package was not properly installed.
Error: The "@angular/compiler-cli" package was not properly installed.
    at Object.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@ngtools\webpack\src\index.js:14:11)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_modules\@angular\cli\tasks\eject.js:10:19)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
因此,我还执行了建议的编辑,并最终编译了前端:

$ ng serve
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200 **
Hash: 5af827dc707fe1859af6
Time: 14752ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 232 kB {4} [initial] [rendered]
chunk    {1} main.bundle.js, main.bundle.js.map (main) 33 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) 3.03 MB [initial] [rendered]
chunk    {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
webpack: Compiled successfully.
但是,
localhost:4200
上的网页无法正常工作。在
localhost:8080
上单击类似“登录”的按钮时,不会发生与以前不同的事情。现在,在我所做的
angularcli
更改之后,
localhost:8080
也被破坏了。它只显示文本“无效端点”。我还注意到,
Public
文件夹现在丢失了,这是我假设之前提供的

我之所以需要
ng service
,是因为我想对前端进行更改。在没有更改的情况下,网站可以使用
mongod--dbpath data
npm install
npm start
在根目录中运行
MongoDB
,然后访问
localhost:8080
,但我希望能够重新编译所有内容并运行


关于如何修复该项目以进行开发,有什么想法吗?如果您不确定某些细节,可以自己下载副本并试用。

是的,在迁移到最新的angular cli版本时,您不应该只更改依赖项。请检查所需的所有步骤。@NicoVanBelle:我读过,我就是这么做的。为什么应用程序会崩溃?我现在在
http://localhost:4200/users/authenticate
链接
$ ng serve
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200 **
Hash: 5af827dc707fe1859af6
Time: 14752ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 232 kB {4} [initial] [rendered]
chunk    {1} main.bundle.js, main.bundle.js.map (main) 33 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) 3.03 MB [initial] [rendered]
chunk    {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
webpack: Compiled successfully.