Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.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
Node.js ng serve:找不到模块'/templates.js';_Node.js_Angular_Angular6 - Fatal编程技术网

Node.js ng serve:找不到模块'/templates.js';

Node.js ng serve:找不到模块'/templates.js';,node.js,angular,angular6,Node.js,Angular,Angular6,我刚刚将Angular 6项目从一台计算机转移到另一台计算机,在新设备中,我在尝试ng服务时出现以下错误 我还尝试过使用npm install templates.js,安装了依赖项,但此错误再次弹出 Cannot find module './templates.js' Error: Cannot find module './templates.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.j

我刚刚将Angular 6项目从一台计算机转移到另一台计算机,在新设备中,我在尝试
ng服务时出现以下错误

我还尝试过使用
npm install templates.js
,安装了依赖项,但此错误再次弹出

Cannot find module './templates.js'
Error: Cannot find module './templates.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.Module._load (internal/modules/cjs/loader.js:529:25)
    at Module.require (internal/modules/cjs/loader.js:658:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (C:\Users\Godwin\Desktop\livigro\node_modules\chalk\index.js:6:18)
    at Module._compile (internal/modules/cjs/loader.js:722:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Module.require (internal/modules/cjs/loader.js:658:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (C:\Users\Godwin\Desktop\livigro\node_modules\postcss\lib\css-syntax-error.js:9:14)
    at Module._compile (internal/modules/cjs/loader.js:722:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
找不到模块'./templates.js'
错误:找不到模块“./templates.js”
在Function.Module.\u解析文件名(internal/modules/cjs/loader.js:603:15)
at Function.Module._load(内部/modules/cjs/loader.js:529:25)
at Module.require(内部/modules/cjs/loader.js:658:17)
根据需要(内部/modules/cjs/helpers.js:22:18)
反对


提前感谢:)

发生这种情况有两个原因:

1. templates.js is not present.
2. templates.js is present but you provided the wrong relative path. 

请检查一下。如果“templates.js”不是外部软件包,则不需要安装。Npm安装用于安装外部软件包。出现这种情况的原因有两个:

1. templates.js is not present.
2. templates.js is present but you provided the wrong relative path. 

请检查一下。如果“templates.js”不是外部软件包,则不需要安装。Npm安装用于安装外部软件包。

删除
节点模块
文件夹,然后再次使用
Npm安装
解决了问题,而
ng serve
工作正常

删除
节点模块
文件夹,然后再次使用
Npm安装
解决了问题,还有
ng服务
工作正常

您在开始消费时是否导入了它?不,您能告诉我如何导入吗?您是在开始消费时导入的吗?不,您能告诉我如何导入吗