Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.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
typescript错误:将覆盖输入文件_Typescript_Ionic Framework_Ionic3 - Fatal编程技术网

typescript错误:将覆盖输入文件

typescript错误:将覆盖输入文件,typescript,ionic-framework,ionic3,Typescript,Ionic Framework,Ionic3,我已更新并删除了src/declarations.d.ts文件。现在,当我尝试运行应用程序时,我的应用程序显示以下错误 typescript:/sophy/src/assets/dev load/load.ts,第1行 模块“../../../node_modules/nprogress/nprogress.js”已解析为“/sophy/node_modules/nprogress/nprogress.js”,但 未设置“--allowJs” L1: import * as NProgr

我已更新并删除了
src/declarations.d.ts
文件。现在,当我尝试运行应用程序时,我的应用程序显示以下错误

typescript:/sophy/src/assets/dev load/load.ts,第1行 模块“../../../node_modules/nprogress/nprogress.js”已解析为“/sophy/node_modules/nprogress/nprogress.js”,但 未设置“--allowJs”

   L1:  import * as NProgress from '../../../node_modules/nprogress/nprogress.js'
   L2:  (() => {
我认为上面的错误不存在,但现在它显示下面的错误

打字错误 无法写入文件“/sophy/node_modules/nprogress/nprogress.js”,因为它 将覆盖输入文件

你知道为什么吗

tsconfig.json

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "es5",
    "allowJs": true
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}
我想这就是问题所在,我该如何解决呢?当我删除
声明.d.ts
时,就会出现上述错误。如果我添加它,则不会出现任何问题(我也必须删除
“allowJs”:true
),请提供任何解决方案

src\assets\load.ts

  import * as NProgress from '../../../node_modules/nprogress/nprogress.js'
    (() => {
      NProgress.start();
    })()

您可以尝试使用js库的类型声明

npm install --save-dev @types/nProgress
可以看到声明文件。 它将被添加到
node_modules/@types
目录中。 做


如果是相同的nProgress,为什么不使用?是的,相同。你能提供答案吗?安装打字机等后,我应该做什么更改@surajI这样做了。但是它在
导入
[ts]文件'd:/sophy/node_modules/@types/nprogress/index.d.ts'不是一个模块上显示了这个错误。
。为什么?我像这样使用了
导入*作为“nprogress”的nprogress
尝试从nprogress导入nprogress
 import Nprogress from 'nprogress'