ngx-responsive: Error: .../sandbox/node_modules/ngx-responsive/src/index.ts is not part of the compilation output. Please check the other error messages for details.

When trying to serve my application I get the following error:

ERROR in ./node_modules/ngx-responsive/src/index.ts
Module build failed: Error: /Users/.../Documents/sandbox/node_modules/ngx-responsive/src/index.ts is not part of the compilation output. Please check the other error messages for details.
    at AngularCompilerPlugin.getCompiledFile (/Users/.../Documents/sandbox/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:624:23)
    at plugin.done.then (/Users/.../Documents/sandbox/node_modules/@ngtools/webpack/src/loader.js:467:39)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
 @ ./node_modules/ngx-responsive/index.js 1:0-109
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts

This is some information about my setup:

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
    
Angular CLI: 1.5.3
Node: 8.3.0
OS: darwin x64
Angular: 5.0.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.5.3
@angular-devkit/build-optimizer: 0.0.33
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.36
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.3
@schematics/angular: 0.1.5
typescript: 2.4.2
webpack: 3.8.1

and my app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { ResponsiveModule } from 'ngx-responsive';
import { AppRoutingModule } from './app-routing.module';

import { AppComponent } from './app.component';


@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    ResponsiveModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

I read in this topic that having TS files in the node_modules folder goes against how libraries should be packaged: libraries should never ship their source .ts files.

I’m not sure if this might be the root of the problem. Anyone else with the same issue?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 24 (4 by maintainers)

Most upvoted comments

@ManuCutillas working on webpack 3 without any issues. Will revert if any. Thanks a lot for the quick fix!

I have exactly same issue


Angular CLI: 1.5.3
Node: 8.9.1
OS: win32 x64
Angular: 5.0.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

@angular/cli: 1.5.3
@angular-devkit/build-optimizer: 0.0.33
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.36
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.3
@schematics/angular: 0.1.5
typescript: 2.4.2
webpack: 3.8.1

I’m having the same problem, using the latest version… Error is the exact same.

Hi @ManuCutillas I don’t think this issue should be closed ? I’m still having the same problem with version 3.1.3 and 3.1.4. Is there any update on this library that fixes the compilation ?

Launched a new version that solves the problem of compilation. ==> v3.1.3

Guys, anybody found a workaround? Doesn’t work with Webpack 3 for me as well

@mburger81 could you please provide more details how exactly you solved it with npm pack ?

Same problem here.

@ManuCutillas can you provide the steps to build. when i tried to do npm run pack got this issue.

Building Angular library Generating bundle for ngx-responsive Cleaning bundle build directory Processing assets Running ngc Compiling to FESM15

BUILD ERROR Could not resolve ‘./src/index’ from .ng_pkg_build/ngx-responsive/ts/index.js Error: Could not resolve ‘./src/index’ from .ng_pkg_build/ngx-responsive/ts/index.js at error (/usr/src/app/node_modules/ngx-responsive/node_modules/rollup/dist/rollup.js:185:14) at then.resolvedId (/usr/src/app/node_modules/ngx-responsive/node_modules/rollup/dist/rollup.js:18244:8) at <anonymous>

@ManuCutillas I re forked you project and do a packaging with the npm script and reinstall this local package in my project, after that anything is fine.

@rtyx @merihs you can try to do the same thing?!?

I have a similar problem on ionic using

Module build failed: Error: ENOENT: no such file or directory, open '/abc/node_modules/ngx-responsive/index.js

@ManuCutillas I think the problem could be the new release with the new packaging method. I’m not an big expert on it, can you help us?