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 
//                 DefinitelyTyped 
//                 Wilco Bakker 
//                 Thomas Bouldin 
//                 Sebastian Silbermann 
//                 Alorel 
//                 Hoàng Văn Khải 
//                 Sander Koenders 
// 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:
/// 

// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
/// 

// TypeScript 3.2-specific augmentations:

修改后:

// Type definitions for Node.js 6.14
// Project: http://nodejs.org/
// Definitions by: Microsoft TypeScript 
//                 DefinitelyTyped 
//                 Wilco Bakker 
//                 Thomas Bouldin 
//                 Sebastian Silbermann 
//                 Alorel 
//                 Hoàng Văn Khải 
//                 Sander Koenders 
// 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:
// 

// Base definitions for all NodeJS modules that are not specific to any version of TypeScript:
// 

// TypeScript 3.2-specific augmentations:

你可能感兴趣的:(angular.js,typescript,前端)