question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript error "TS2307: Cannot find module '../aurelia.json'" within build tasks

See original GitHub issue

I’m submitting a bug report (i guess)

  • Library Version: 1.0.8

Please tell us about your environment:

  • Operating System: Windows 10

  • Node Version: 6.9.4

  • NPM Version: 4.1.1

  • Browser: Not Browser related

  • Language: TypeScript 2.1.5

  • Current behavior: The line import * as project from '../aurelia.json'; inside the build tasks (aurelia_project\tasks\build.ts, aurelia_project\tasks\process-css.ts etc.) reports the TypeScript error TS2307: Cannot find module '../aurelia.json' even though the file aurelia.json exists in the folder aurelia_project.

  • What is the expected behavior? Whilst building etc. is actually working as expected, I find it annoying & misleading to see TypeScript errors in my IDE (files & folders are marked red, the TypeScript panel shows those erros etc.) and I guess it will bite me when starting create a deploy process.

This can be reproduced by creating a new project using au new with the following options (CLI version ``):

  • 3 Custom
  • 2 TypeScript
  • 3 Max minification
  • 3 Sass
  • 1 Yes (Unit Testing)
  • 4 WebStorm
  • 1 Yes (Create Project)
  • 1 Yes (Install Dependencies)

The errors are reported within PhpStorm 2016.3.2 as well as VSCode 1.8.1 & 1.9.1

Ps.: I’m not sure if this is related to https://github.com/aurelia/cli/issues/300 even though the title suggests otherwise since I believe that the issue there is about including JSON files within the source code, not within the build…

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

70reactions
sbolelcommented, Feb 23, 2017

Following https://github.com/aurelia/cli/issues/300#issuecomment-251072000, can you try adding a file “json-loader.d.ts” in custom_typings/ with the contents:

declare module "*.json" {
    const value: any;
    export default value;
}
38reactions
sbolelcommented, Feb 23, 2017

~Can you please try changing the import statement to:~

import project from '../aurelia.json';
Read more comments on GitHub >

github_iconTop Results From Across the Web

TS cannot find modules - typescript
json file in your workspace. If so, all you need to do is install typings ( npm install typings --global ) and then...
Read more >
cmichaelgraham/aurelia-typescript
I ask as I'm having an issue with with kit-typescript, under WebStorm 11, which generates the following error message, "error TS2307: Cannot find...
Read more >
CLI + built-in Bundler Advanced
To build a multi-tenancy app, you can ignore moduleId "client-info" at bundling time, then fills it up at runtime. First, calm CLI bundler...
Read more >
How to fix Error: cannot find module "webpack"
Solution · 1. Install webpack in the local app folder · 2. Link webpack to your project.
Read more >
Aurelia, Visual Studio Code and TypeScript - mobilemancer -
Aurelia with TypeScript in Visual Studio Code on ASP.NET 5 ... AureliaLogic\app.ts(1,27): error TS2307: Cannot find module 'aurelia-router'.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found