Open ThorvaldAagaard opened 6 years ago
Hi @ThorvaldAagaard!
Can you please check if the file/link exists in your project: node-modules/.bin/ionic2-custom-icons
? According to your logs the full path should be D:\Documents\github\geme.io\node_modules\.bin\ionic2-custom-icons
.
This is the file that gets called by the trigger ionic:watch:before
respectively ionic:build:before
.
The file is there. As I am running windows I expect the
D:\Documents\github\geme.io\node_modules\.bin\ionic2-custom-icons.cmd
to be executed.
So I added a single output line in it, and I can see it is executed, when run Ionic Serve outside VS Code, but not inside.
So how does ionic serve know where to look for the file?
I have absolutely no clue why the code runs fine outside Visual Studio Code and fails inside. I'm afraid I can't give you any support on that problem as I'm not using VS Code. But I don't think it is directly related to this library. Please let me if you find a solution.
Indeed a very strange problem.
I copied the folder: Same issue Cleared NPM-cached and reinstalled all plugins: Same issue Created a new project and copied Source, config, icons and project files: Same issue
Working my way thru I created a starter project at copied all source-files after adding ionic2-custom-icons first, and it still worked. Copied the rest of the files and now it failed, and it seemed like it was package.json that was the problem. Then I moved the config section for ionic2-custom-icons up before the script section, and voila, now it works.
I tried just to move the config in the old project, but that did not help.
But I think I have wasted enough time on that now, as I now again have a working project inside VS Code.
Thx for taking the time to respond, sometimes it is good just to describe the problem :-) I will close this now
A have learned a little more as it seems that as soon as I add another element in config I get the error
This works
"config": {
"ionic_copy": "./config/copy.config.js",
"ionic_sass": "./config/sass.config.js",
"custom_icons": "./config/custom-icons.config.js"
},
This doesnt work
"config": {
"ionic_generate_source_map": "true",
"ionic_copy": "./config/copy.config.js",
"ionic_sass": "./config/sass.config.js",
"custom_icons": "./config/custom-icons.config.js"
},
But this work
"config": {
"ionic_generate_source_map": "true",
"ionic_copy": "./config/copy.config.js",
"custom_icons": "./config/custom-icons.config.js"
},
Did you found out, what caused the problem, @ThorvaldAagaard ? I have exactly the same behaviour. If I run the command in a terminal or powershell on Windows 10, it works and the ionic2-custom-icons script is executed correctly. But if I try to run it in the integrated terminal of Visual Studio Code, I get the same error you described above. Your suggestions modifying the package.json didn't do the trick for me. Thanks in advance!
I was finally able to reproduce this problem on a Windows machine.
For some reason when ionic-cli
calls the npm scripts (from package.json
) the executables in node_modules/.bin
aren't available. Strangely enough this works if I call the npm scripts from the command line outside the Ionic lifecycle.
Currently I have no idea what causes this problem. Maybe the way ionic-cli
calls npm!?
A workaround is to provide a path to the target script of the library. Edit the scripts ionic:watch:before
and ionic:build:before
in your package.json
like this:
...
"ionic:watch:before": "node ./node_modules/ionic2-custom-icons/npm-script/bin/ionic2-custom-icons.js",
"ionic:build:before": "node ./node_modules/ionic2-custom-icons/npm-script/bin/ionic2-custom-icons.js",
...
Note: As far as I know this problem only occurs on Windows and not for all users.
Great. Lately this happens to me a lot of time using visual code.
Even in a cmd prompt I have seen it. My work around is now. Execute script. If it fails execute again. After 3 failing attempts, go get some coffee. When returning it normally works 😁.
I will try your suggestion and return with status
I have the same problem on Windows 10. I find another workaround by installing the plugin globally with :
npm install -g ionic2-custom-icons --save
I can try that, but after applying the change suggested by Gerrit, it has been working fine
I have been using your plugin for quite a while, but have recently moved ny apps to a new pc, and during that updated a lot of stuff.
My problem is that in one of my apps the building including your script is working fine, but in the other application I get an error.
The error looks like this
and the log file contains
And in the other project the output looks like this
I have tried remove and reinstall the plugin, the platform etc but nothing seems to help.
Unfortunately I don't have access to my old machine to verify it still works there
The really strange thing is that if I execute the command from the log-file:
The result looks ok ?
Any idea about what I can be missing?
It seems it is only inside Visual Studio I have this problem