ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

modules path issue on CLI 3.9.2

Open jayserdny opened this issue 9 years ago • 8 comments

After update from CLI 3.8.1 to 3.9.2 I am getting error with imported modules. For example, here is an output of the error:

Error: ./src/pages/profile/edit-profile/edit-profile.ngfactory.js Module not found: Error: Can't resolve '../../../../angularfire2/auth' in '/Users/Jayser/Documents/aplicaciones/vendeloC/src/pages/profile/edit-profile' resolve '../../../../angularfire2/auth' in '/Users/Jayser/Documents/aplicaciones/vendeloC/src/pages/profile/edit-profile' using description file: /Users/Jayser/Documents/aplicaciones/vendeloC/package.json (relative path: ./src/pages/profile/edit-profile) Field 'browser' doesn't contain a valid alias configuration after using description file: /Users/Jayser/Documents/aplicaciones/vendeloC/package.json (relative path: ./src/pages/profile/edit-profile) using description file: /Users/Jayser/Documents/aplicaciones/vendeloC/package.json (relative path: ./angularfire2/auth)

However, application works in browser but when I try to run in a device it gives this error.

My tsconfig.json is the following: { "compilerOptions": { "baseUrl": ".", "allowSyntheticDefaultImports": true, "declaration": false, "emitDecoratorMetadata": true, "experimentalDecorators": true, "lib": [ "dom", "es2015" ], "module": "es2015", "moduleResolution": "node", "sourceMap": true, "target": "es5" }, "include": [ "src/**/*.ts" ], "exclude": [ "node_modules" ], "compileOnSave": false, "atom": { "rewriteTsconfig": false } }

jayserdny avatar Aug 22 '17 01:08 jayserdny

@jayserdny I am getting the same error, can you share your fix?

lostdev avatar Aug 24 '17 14:08 lostdev

@lostdev I just created a new project and move all my code there. It worked for me.

jayserdny avatar Aug 24 '17 18:08 jayserdny

What causes the actual error? Can you fill out the issue template?

imhoffd avatar Aug 29 '17 21:08 imhoffd

@dwieeb the problem seems to be related to angular fire library. After updating the CLI, I started getting this error. However, I worked around to fix this problem by moving the angulafire2 directory from node_modules to root folder. It is not the best solution, however, it allows me to continue developing my app.

For those that want to test, here are the steps to reproduce this problem:

  1. Create an empty Ionic 2 project.
  2. Install the angularfire2 library
  3. Initialize it.
  4. Run the app.

I will create a repository to reference this issue.

jayserdny avatar Sep 05 '17 04:09 jayserdny

Sounds more like an issue with that library or your node_modules setup, not a CLI issue. May I close this?

imhoffd avatar Sep 05 '17 15:09 imhoffd

@dwieeb sure, you can close this issue. I will open an issue in the library repo.

jayserdny avatar Sep 05 '17 20:09 jayserdny

Library author here.

@dwieeb I'm not familiar with the build system, but it should take a look at the package.json at the import location: angularfire2/auth. This is not a deep import, it is it's own package that contains a package.json. I'm not sure why it's being transformed into a relative import: '../../../../angularfire2/auth'.

Any ideas?

davideast avatar Sep 11 '17 16:09 davideast

It is weird that it's being converted into a relative path. Hmm.

Thanks, Dan

danbucholtz avatar Sep 12 '17 16:09 danbucholtz