ERROR in D:/project/node_modules/@types/node/index.d.ts (20,1): Invalid‘ reference‘ directive syntax

运行angular项目报错

ERROR in D:/project/node_modules/@types/node/index.d.ts  (20,1): Invalid ' reference' directive syntax.

PS D:\project> ng serve --open
As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release,
which will only support Node 6.9 and greater. This package will be officially deprecated    
shortly after.

To disable this warning use "ng set --global warnings.packageDeprecation=false".

fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
** NG Live Development Server is running on http://localhost:4200. **
 10% building modules 6/6 modules 0 active(node:21608) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see 
https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
(Use `node --trace-deprecation ...` to show where the warning was created)
 11% building modules 10/11 modules 1 active ...ode_modules\style-loader\addStyles.jswebpack: wait until bundle finished: /
Hash: cee4d5d5915b3d2119ce                                                               
Time: 5923ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.map (polyfills) 248 kB {4} [initial] [rendered]
chunk    {1} main.bundle.js, main.bundle.map (main) 4.02 kB {3} [initial] [rendered]
chunk    {2} styles.bundle.js, styles.bundle.map (styles) 9.71 kB {4} [initial] [rendered]
chunk    {3} vendor.bundle.js, vendor.bundle.map (vendor) 2.64 MB [initial] [rendered]
chunk    {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]

ERROR in D:/project/node_modules/@types/node/index.d.ts  (20,1): Invalid ' reference' directive syntax.
webpack: Failed to compile.

解决方法: D:/project/node_modules/@types/node/index.d.ts   去掉3个\\\斜杆修改成 2个斜杠,再次运行项目。

修改前:

// Type definitions for Node.js 6.14
// Project: http://nodejs.org/
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
//                 DefinitelyTyped <https://github.com/DefinitelyTyped>
//                 Wilco Bakker <https://github.com/WilcoBakker>
//                 Thomas Bouldin <https://github.com/inlined>
//                 Sebastian Silbermann <https://github.com/eps1lon>
//                 Alorel <https://github.com/Alorel>
//                 Hoàng Văn Khải <https://github.com/KSXGitHub>
//                 Sander Koenders <https://github.com/Archcry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// NOTE: These definitions support NodeJS and TypeScript 3.2 and above.

// NOTE: TypeScript version-specific augmentations can be found in the following paths:
//          - ~/base.d.ts         - Shared definitions common to all TypeScript versions
//          - ~/index.d.ts        - Definitions specific to TypeScript 2.1
//          - ~/ts3.2/index.d.ts  - Definitions specific to TypeScript 3.2

// Reference required types from the default lib:
/// <reference lib="es2015" />

// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
/// <reference path="base.d.ts" />

// TypeScript 3.2-specific augmentations:

修改后:

// Type definitions for Node.js 6.14
// Project: http://nodejs.org/
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
//                 DefinitelyTyped <https://github.com/DefinitelyTyped>
//                 Wilco Bakker <https://github.com/WilcoBakker>
//                 Thomas Bouldin <https://github.com/inlined>
//                 Sebastian Silbermann <https://github.com/eps1lon>
//                 Alorel <https://github.com/Alorel>
//                 Hoàng Văn Khải <https://github.com/KSXGitHub>
//                 Sander Koenders <https://github.com/Archcry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// NOTE: These definitions support NodeJS and TypeScript 3.2 and above.

// NOTE: TypeScript version-specific augmentations can be found in the following paths:
//          - ~/base.d.ts         - Shared definitions common to all TypeScript versions
//          - ~/index.d.ts        - Definitions specific to TypeScript 2.1
//          - ~/ts3.2/index.d.ts  - Definitions specific to TypeScript 3.2

// Reference required types from the default lib:
// <reference lib="es2015" />

// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
// <reference path="base.d.ts" />

// TypeScript 3.2-specific augmentations:

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值