Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Webpack/Ionic 2 #69

Closed
CelsoSantos opened this issue Aug 29, 2017 · 9 comments
Closed

Error with Webpack/Ionic 2 #69

CelsoSantos opened this issue Aug 29, 2017 · 9 comments

Comments

@CelsoSantos
Copy link

CelsoSantos commented Aug 29, 2017

Hi,

I'm using [email protected] and unlike other issues I have seen around here, I have no problems doing a build with the --prod flag.

However, once I try to run the application I get the following error on Chrome:

Uncaught Error: Module build failed: Error: ENOENT: no such file or directory, open '/Users/dev/ionic/node_modules/ngx-clipboard/src/index.js'

When taking a look at what the code produces, I noticed that ngx-clipboard DID build, but the correct path would be '/Users/dev/ionic/node_modules/ngx-clipboard/dist/index.js'. (notice the dir is dist instead of src)

I don't think it makes a difference, but here's my Ionic project tsconfig.json:

{
	"compilerOptions": {
		"allowSyntheticDefaultImports": true,
		"declaration": false,
		"emitDecoratorMetadata": true,
		"experimentalDecorators": true,
		"lib": [
			"dom",
			"es2015"
		],
		"module": "es2015",
		"moduleResolution": "node",
		"sourceMap": true,
		"target": "es6"
	},
	"include": [
		"src/**/*.ts"
	],
	"exclude": [
		"node_modules"
	],
	"compileOnSave": false,
	"atom": {
		"rewriteTsconfig": false
	}
}

How can I solve this issue? Why is this build outdir and webpack build version not matching the paths correctly?

@CelsoSantos
Copy link
Author

Also, let me add another question which is:

Why are we getting the .ts files when doing npm install instead of getting a ready-made build like, for instance, ng2-translate ??

@maxisam
Copy link
Owner

maxisam commented Aug 31, 2017

well, it is just convenient if someone wanna debug through. It since it is pretty small, I don't think having source in it would causing any issue.

Back to your original question, I don't know because I don't use ionic. Maybe you can try the latest version?

I think the main entry defined in package.json might be the reason causing that issue. The latest version might fix it already.

@CelsoSantos
Copy link
Author

CelsoSantos commented Aug 31, 2017 via email

@maxisam
Copy link
Owner

maxisam commented Aug 31, 2017

you don't need to switch to latest right now. You just create a test project like the way you are setting but use angular 4 and you can test against with the latest code. If the latest code work, it shouldn't be too hard to fix. @

@dweber019
Copy link

dweber019 commented Oct 6, 2017

Have the same issue with angular 4.

imported the module into the page module and then this error is showing:

Uncaught (in promise): Error: Module build failed: Error: ENOENT: no such file or directory, open '/Users/xyx/Desktop/Dipl Repos/TEKO-dipl-fontend/node_modules/ngx-window-token/index.js.map' at Error (native) Error: Module build failed: Error: ENOENT: no such file or directory, open '/Users/xyx/Desktop/Dipl Repos/TEKO-dipl-fontend/node_modules/ngx-window-token/index.js.map' at Error (native) at Object.378 (http://localhost:8100/build/8.js:298:7) at webpack_require (http://localhost:8100/build/vendor.js:55:30) at Object.142 (http://localhost:8100/build/8.js:12:81) at webpack_require (http://localhost:8100/build/vendor.js:55:30) at Object.377 (http://localhost:8100/build/8.js:194:77) at webpack_require (http://localhost:8100/build/vendor.js:55:30) at Object.476 (http://localhost:8100/build/8.js:320:79) at webpack_require (http://localhost:8100/build/vendor.js:55:30) at Object.475 (http://localhost:8100/build/8.js:306:69) at webpack_require (http://localhost:8100/build/vendor.js:55:30)

@maxisam
Copy link
Owner

maxisam commented Oct 17, 2017

Please try 8.1.1. Will reopen if the problem still exists.

@maxisam maxisam closed this as completed Oct 17, 2017
@jasonz1987
Copy link

jasonz1987 commented Oct 30, 2017

have the same issue when i try 8.1.1.

Error: ./node_modules/ngx-clipboard/src/clipboard.directive.ts
Module build failed: Error: ENOENT: no such file or directory, open '/Users/tuo3/git/drip-ionic3/node_modules/ngx-clipboard/src/clipboard.directive.js'
 @ ./src/pages/about/about.ngfactory.ts 35:0-61
 @ ./src/pages/about/about.module.ngfactory.ts
 @ ./src lazy
 @ ./node_modules/ionic-angular/util/ng-module-loader.js
 @ ./src/app/app.module.ngfactory.ts
 @ ./src/app/main.ts,./node_modules/ngx-clipboard/src/clipboard.service.ts
Module build failed: Error: ENOENT: no such file or directory, open '/Users/tuo3/git/drip-ionic3/node_modules/ngx-clipboard/src/clipboard.service.js'
 @ ./src/pages/about/about.module.ngfactory.ts 22:0-59
 @ ./src lazy
 @ ./node_modules/ionic-angular/util/ng-module-loader.js
 @ ./src/app/app.module.ngfactory.ts
 @ ./src/app/main.ts,./node_modules/ngx-clipboard/src/index.ts

@bergergit
Copy link

Are there any solutions for this error? I'm also trying to compile with AOT (using --prod) and I get the same error, even with 8.1.1.

@DouglasLapsley
Copy link

I'm also having this problem. Ionic 3, Angular 5.2.11, ngx-clipboard: "^8.1.1".

Build command:

ionic build --aot --minifyjs --minifycss

Error on build:

Error: ./node_modules/ngx-clipboard/src/clipboard.directive.ts Module build failed: Error: ENOENT: no such file or directory, open '/MYPATH/node_modules/ngx-clipboard/src/clipboard.directive.js'

Any pointers would be welcome. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants