4

I just created a new Ionic 2 rc0 app and I was able to run it last night.

However, after putting the computer to sleep while ionic serve was running, trying to start the app today after closing ionic serve yielded this error:

Running 'serve:before' npm script before serve > ionic-hello-world@ watch J:\ionic projects\newionicapp > ionic-app-scripts watch module.js:457 throw err; ^ Error: Cannot find module '../dist/index' at Function.Module._resolveFilename (module.js:455:15) at Function.Module._load (module.js:403:25) at Module.require (module.js:483:17) at require (internal/module.js:20:19) at Object.<anonymous> (J:\ionic projects\newionicapp\node_modules\@ionic\app-scripts\bin\ionic-app-scripts.js:19:3) at Module._compile (module.js:556:32) at Object.Module._extensions..js (module.js:565:10) at Module.load (module.js:473:32) at tryModuleLoad (module.js:432:12) at Function.Module._load (module.js:424:3) npm ERR! Windows_NT 10.0.10586 npm ERR! argv "J:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\rosst\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "watch" npm ERR! node v6.7.0 npm ERR! npm v3.10.8 npm ERR! code ELIFECYCLE npm ERR! ionic-hello-world@ watch: `ionic-app-scripts watch` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the ionic-hello-world@ watch script 'ionic-app-scripts watch'. 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 ionic-hello-world package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! ionic-app-scripts watch npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs ionic-hello-world npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls ionic-hello-world npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! J:\rosst\ionic projects\newionicapp\npm-debug.log Caught exception: undefined Mind letting us know? https://github.com/driftyco/ionic-cli/issues 

If I create a new app, it runs fine. So I think something broke inside my project. But I have no idea what.

3
  • 1
    not sure why someone down voted this questions and SO should have some option to add a comment when down voting. :). Coz this was down voted under off topic , but the question seems legit to me Commented Oct 5, 2016 at 1:46
  • You can also try by removing the entire node-modules folder and then running npm install again... Commented Oct 5, 2016 at 7:06
  • 1
    @sebaferreras this worked for me including removing the .tmp folder. Commented Oct 5, 2016 at 8:39

5 Answers 5

15

Delete your node_modules folder then run npm install to reinstall all modules. This will ensure all node modules are clean.

Also delete the contents of your www folder and then run ionic serve to regenerate the files. This will ensure your project build is clean.

If that doesn't work, try updating your ionic-cli to the latest version by running npm install -g [email protected] then try the above again.

The Ionic CLI uses a version of ionic-app-scripts which is not a specific target version. Ionic-app-scripts has been updated and although ionic-cli has not, it now uses a more recent version of ionic-app-scripts, which caused a few problems for me.

Good luck!

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer works with Ionic 4 as well. Deleting the www folder solved the problem.
7

Try updating the ionic app-scripts.

npm i @ionic/app-scripts

It worked for me.

Comments

1

I got this same problem, and i research a lot and found one solution try this command on your terminal -

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p 

Comments

0

I found somewhat similar error and it looks like its something to do with updating npm.

so try updating the npm to latest. read here on steps to upgrade.

PS: however this doesnt explain why it works for a new project. :)

Comments

0

I had ALOT of problems with this. I search the internet and tried every possible solution out there without luck.

I finally found out that removing spaces from the app name made everything work. So delete det app folder with all the contents, and create a new one with no spaces in the name.

That worked for me anyway.

1 Comment

It seems the problem in the question is not extra spaces

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.