Error while trying to install ngx-translate


#1

When executing the command:
npm install @ ngx-translate / core @ ngx-translate / http-loader --save

I get the error:

ionic-hello-world@0.0.0 D: \ Ionic \ Time_Worked

    • UNMET PEER DEPENDENCY @ angular / common @ 4.1.2
    • UNMET PEER DEPENDENCY @ angular / core @ 4.1.2
    • @ ngx-translate / core @ 8.0.0
      `- @ ngx-translate / http-loader @ 2.0.0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules \ chokidar \ node_modules \ fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {“os”: “darwin”, “arch”: “any”} (current: {“os”: “win32”, “arch”: “x64”})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules \ @ionic \ app-scripts \ node_modules \ chokidar \ node_modules \ fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {“os”: “darwin”, “arch”: “any”} (current: {“os”: “win32”, “arch”: “x64”})
npm WARN @ ngx-translate / http-loader @ 2.0.0 requires a peer of @ angular / core @> = 4.3.0 but none was installed.
npm WARN @ ngx-translate / http-loader @ 2.0.0 requires a peer of @ angular / common @> = 4.3.0 but none was installed.

I already executed the command:
npm install -g rxjs@^5.0.1

With the log:
C: \ Users \ silva \ AppData \ Roaming \ npm
`- rxjs@5.0.1

And also the command:
npm install -g @ angular / cli

With the log:
C: \ Users \ silva \ AppData \ Roaming \ npm \ ng -> C: \ Users \ silva \ AppData \ Roaming \ npm \ node_modules \ @angular \ cli \ bin \ ng
C: \ Users \ silva \ AppData \ Roaming \ npm
`- @ angular / cli @ 1.4.9

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules \ @angular \ cli \ node_modules \ chokidar \ node_modules \ fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {“os”: “darwin”, “arch”: “any”} (current: {“os”: “win32”, “arch”: “x64”})

When trying to import: @ angular / common / http in app.module.ts, I get the error: “[ts] Can not find module ‘@ angular / common / http’.”

If anyone can give me a solution, I would be extremely grateful.


#2

I was able to solve by following the tips of this question (https://github.com/ngx-translate/core/issues/629). I will detail here, as it may be useful for someone facing the same problem.

Basically what I did, was to use the command:
npm install @ngx-translate/core @ngx-translate/http-loader@0.1.0 --save

Instead of the command:
npm install @ngx-translate/core @ngx-translate/http-loader --save

Described in Ionic’s ngx-translate documentation.