Error running "npm run Prod" command in Git Bash to build an Ionic 2 project

Asked

Viewed 518 times

0

I have a publication ready project, which was created with Ionic 2 using Google’s Firebase API, but when I try to build the project for production, with the following command in Git Bash: "npm run Prod", an error is displayed in which I could not identify. Follow the error below:

$ npm run prod

> [email protected] prod C:\nodejs\apps\ionic2\Ionic2FirebaseChat
> ionic-app-scripts build --prod

[16:17:40]  ionic-app-scripts 3.0.0
[16:17:40]  build prod started ...
[16:17:42]  clean started ...
[16:17:42]  clean finished in 117 ms
[16:17:42]  copy started ...
[16:17:42]  deeplinks started ...
[16:17:42]  deeplinks finished in 177 ms
[16:17:42]  ngc started ...
[16:18:14]  ngc finished in 31.45 s
[16:18:14]  preprocess started ...
[16:18:14]  copy finished in 32.34 s
[16:18:14]  preprocess finished in 285 ms
[16:18:14]  webpack started ...
[16:19:07]  ionic-app-script task: "build"
[16:19:07]  Error: ./models/chat.model.ts Module build failed: Error: ENOENT: no such file or directory, open
            'C:\nodejs\apps\ionic2\Ionic2FirebaseChat\models\chat.model.js' at Error (native) @ ./src/pages/home/home.ts
            10:0-50 @ ./src/pages/sign/sign.ts @ ./src/components/base.component.ts @
            ./src/components/user-menu/user-menu.component.ts @ ./src/app/app.component.ngfactory.ts @
            ./src/app/app.module.ngfactory.ts @ ./src/app/main.ts,./models/message.model.ts Module build failed: Error:
            ENOENT: no such file or directory, open 'C:\nodejs\apps\ionic2\Ionic2FirebaseChat\models\message.model.js'
            at Error (native) @ ./src/pages/chat/chat.ts 4:0-56 @ ./src/app/app.module.ts @
            ./src/app/app.module.ngfactory.ts @ ./src/app/main.ts,./models/user.model.ts Module build failed: Error:
            ENOENT: no such file or directory, open 'C:\nodejs\apps\ionic2\Ionic2FirebaseChat\models\user.model.js' at
            Error (native) @ ./src/components/user-menu/user-menu.component.ts 6:0-50 @
            ./src/app/app.component.ngfactory.ts @ ./src/app/app.module.ngfactory.ts @ ./src/app/main.ts
Error: ./models/chat.model.ts
Module build failed: Error: ENOENT: no such file or directory, open 'C:\nodejs\apps\ionic2\Ionic2FirebaseChat\models\chat.model.js'
    at Error (native)
 @ ./src/pages/home/home.ts 10:0-50
 @ ./src/pages/sign/sign.ts
 @ ./src/components/base.component.ts
 @ ./src/components/user-menu/user-menu.component.ts
 @ ./src/app/app.component.ngfactory.ts
 @ ./src/app/app.module.ngfactory.ts
 @ ./src/app/main.ts,./models/message.model.ts
Module build failed: Error: ENOENT: no such file or directory, open 'C:\nodejs\apps\ionic2\Ionic2FirebaseChat\models\message.model.js'
    at Error (native)
 @ ./src/pages/chat/chat.ts 4:0-56
 @ ./src/app/app.module.ts
 @ ./src/app/app.module.ngfactory.ts
 @ ./src/app/main.ts,./models/user.model.ts
Module build failed: Error: ENOENT: no such file or directory, open 'C:\nodejs\apps\ionic2\Ionic2FirebaseChat\models\user.model.js'
    at Error (native)
 @ ./src/components/user-menu/user-menu.component.ts 6:0-50
 @ ./src/app/app.component.ngfactory.ts
 @ ./src/app/app.module.ngfactory.ts
 @ ./src/app/main.ts
    at BuildError.Error (native)
    at new BuildError (C:\nodejs\apps\ionic2\Ionic2FirebaseChat\node_modules\@ionic\app-scripts\dist\util\errors.js:16:28)
    at callback (C:\nodejs\apps\ionic2\Ionic2FirebaseChat\node_modules\@ionic\app-scripts\dist\webpack.js:123:28)
    at emitRecords.err (C:\nodejs\apps\ionic2\Ionic2FirebaseChat\node_modules\webpack\lib\Compiler.js:269:13)
    at Compiler.emitRecords (C:\nodejs\apps\ionic2\Ionic2FirebaseChat\node_modules\webpack\lib\Compiler.js:375:38)
    at emitAssets.err (C:\nodejs\apps\ionic2\Ionic2FirebaseChat\node_modules\webpack\lib\Compiler.js:262:10)
    at applyPluginsAsyncSeries1.err (C:\nodejs\apps\ionic2\Ionic2FirebaseChat\node_modules\webpack\lib\Compiler.js:368:12)
    at next (C:\nodejs\apps\ionic2\Ionic2FirebaseChat\node_modules\tapable\lib\Tapable.js:218:11)
    at Compiler.compiler.plugin (C:\nodejs\apps\ionic2\Ionic2FirebaseChat\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:99:4)
    at Compiler.applyPluginsAsyncSeries1 (C:\nodejs\apps\ionic2\Ionic2FirebaseChat\node_modules\tapable\lib\Tapable.js:222:13)

npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "prod"
npm ERR! node v6.11.4
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] prod: `ionic-app-scripts build --prod`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] prod script 'ionic-app-scripts build --prod'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the Ionic2FirebaseChat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ionic-app-scripts build --prod
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs Ionic2FirebaseChat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls Ionic2FirebaseChat
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\nodejs\apps\ionic2\Ionic2FirebaseChat\npm-debug.log

My application settings are these:

cli packages: (C:\Users\chris\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.13.1
    ionic (Ionic CLI) : 3.13.1

global packages:

    cordova (Cordova CLI) : 6.5.0

local packages:

    @ionic/app-scripts : 3.0.0
    Cordova Platforms  : browser 4.1.0
    Ionic Framework    : ionic-angular 3.7.1

System:

    Android SDK Tools : 25.2.5
    Node              : v6.11.4
    npm               : 3.10.10
    OS                : Windows 10

Misc:

    backend : pro

1 answer

0

Try to rotate npm run production instead of npm run prod.

This can be the version of Node.js... Update the version with the command: npm update -g.

  • I ran the Node.js update command, and tried running the npm run Production command instead of npm run Prod. But it didn’t work either, displaying npm ERR! errors, very similar to the recent "npm run Prod command".

  • I found my mistake. It was a folder I created of code outside the folder destined to such, the "src". I passed this to the correct folder and Build worked correctly. Anyway, thanks for the help.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.