Build ios [ERROR] An error occurred while running npm install (exit code 254):

when I run: ionic cordova build ios --prod

? Looks like a fresh checkout! No ./node_modules directory found. Would you like to install project dep
endencies? Yes
[INFO] Installing dependencies may take several minutes!

npm install
:heavy_multiplication_x: Running command - failed!
[ERROR] An error occurred while running npm install (exit code 254):

    npm ERR! addLocal Could not install 
    /Users/.../pojectname-cordova-pl_ugin-thumbtool
    npm ERR! Darwin 16.7.0
    npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
    npm ERR! node v6.11.3
    npm ERR! npm  v3.10.10
    npm ERR! path 
    /Users/.../pojectname-cordova-pl_ugin-thumbtool
    npm ERR! code ENOENT
    npm ERR! errno -2
    npm ERR! syscall open
    
    npm ERR! enoent ENOENT: no such file or directory, open 
    '/Users/.../pojectname-cordova-pl_ugin-thumbtool'
    npm ERR! enoent ENOENT: no such file or directory, open 
    '/Users/.../pojectname-cordova-pl_ugin-thumbtool'
    npm ERR! enoent This is most likely not a problem with npm itself
    npm ERR! enoent and is related to npm not being able to find a file.
    npm ERR! enoent 
    
    npm ERR! Please include the following file with any support request:
    npm ERR!     

Please help me!

Not sure on that one. If you’re on linux / osx could you try…

sudo npm install

thank you I am on osx.
but when now have other err:

cordova build ios
⠋ Running command [15:24:01] lint finished in 3.66 s
:heavy_multiplication_x: Running command - failed!

[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova build ios (exit code 1):

    (truncated) ...

Please help me!!

Does…

ionic serve

Work?

It might be a version conflicts, as you have installed NPM later. There are possibilities of version dependencies conflict problem. I am not sure about it. but it happens sometime.

Yes It work, But when build for ios have err. How can I do?

Can you build for browser?

ionic cordova build browser --prod

That’ll let you know if the issue is to do with the bundling / transpiling process or the xcode bit.

No, have err:
ionic cordova build browser --prod

cordova platform add --save browser
:heavy_multiplication_x: Running command - failed!
[ERROR] An error occurred while running cordova platform add --save browser
(exit code 1):

    Using cordova-fetch for cordova-browser@~4.1.0
    Adding browser project...

You’ve got larger problems clearly.

I’d try starting a brand new project and building that, both for browser and iOS with the --prod switch.

ionic start SomeOtherProject
cd ./SomeOtherProject
ionic cordova build browser --prod

This is a version conflict problem. Better you create a new project and install new plugins from start and you can copy your .ts code from older project.

you mean version ionic, cordova I am using for build and version created project was conflict?

Yes its conflict. Because you upgraded node modules. So there are major possibilities of version conflicts on plugin that you have used. the same problem I have faced before. So I created a new project with updated plugins and copied my previous project code and it worked.

I hope you will also get an error free code after creating a new project

Have not other solution? I can not do that. Because I do not know so deep abut ionic and cordova,

In my consideration I dont think you have any other option.
I hope the Ionic experts will show you a right way to rid out this issue.

This trouble was fix by way, I change version value in file package.json
"dependencies": {
"@angular/common": “4.1.3”,
"@angular/compiler": “4.1.3”,
"@angular/compiler-cli": “4.1.3”,
"@angular/core": “4.1.3”,
"@angular/forms": “4.1.3”,
"@angular/http": “4.1.3”,
"@angular/platform-browser": “4.1.3”,
"@angular/platform-browser-dynamic": “4.1.3”,

}
build ios platform again by:
cordova platform add ios --save

Thanksyou.

Told you it was a version conflict :slight_smile:
Anyway thats great you found the way.
Happy coding :slight_smile:

Yes, Thank you so much.