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

Posted tmmi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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:

以上是关于ERROR in D:/project/node_modules/@types/node/index.d.ts (20,1): Invalid‘ reference‘ directive syntax的主要内容,如果未能解决你的问题,请参考以下文章

text java_error_in_PYCHARM_11693.log

Solve Error: nafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned in

cv2.error: OpenCV(4.5.2) .error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

python keep_1st_sign_dig_in error.py

Workbox with Angular 12 Error: Can't find self.__WB_MANIFEST in your SW source

exec format error in docker