Error: Cannot find module '@ionic/app-scripts'

杀马特。学长 韩版系。学妹 提交于 2019-11-27 10:09:31

问题


I'm new to Ionic. I was following the Ionic documentation "get started", created a project sample named "super". The problem is that when I run the command line ionic serve in the project directory, it threw an error Error: Cannot find module '@ionic/app-scripts'


回答1:


app-scripts currently compatible with node 6 and 7. İf you installed node 8, then please uninstall and install node 6 stable version. This solved error and now i can use ionic 3, angular 4 . Take care!




回答2:


Try installing app-script from npm

npm i @ionic/app-scripts




回答3:


To get the latest @ionic/app-scripts, run the following command:

npm install @ionic/app-scripts@latest --save-dev



回答4:


do not downgrade the node version, update the version of "app-scripts":

To get the latest @ionic/app-scripts, please run:

npm install @ionic/app-scripts@latest --save-dev



回答5:


I was facing same issue, here is what I did-

  1. Removed node_modules from directory (Manually).
  2. open project dir
  3. run this command-

 npm install

That fixed those errors for me.

See here.




回答6:


I had this issue , i solved it by deleting node_modules/ folder and ran the command npm installnow my app works




回答7:


I tried every non-downgrade solution mentioned in this thread, in all kinds of ways and none of them worked. With nothing left to lose, I went down the downgrade route (I used sudo apt-get purge --auto-remove nodejs to remove previous 8.x version and then installed the last stable ver on the 6.x branch using the nodesource ppa).

Still got the same errors trying to run in the original project folders, but then I created a new project and ionic serve worked just fine in that space.

FWIW, I did not need to run npm update or npm i @ionic/app-scripts afterwards, but I did find it necessary to adopt the habit of running commands with sudo in front (or you sudo -s into root account).




回答8:


I ran into the same issue and i had problems fixing it. However i update my app scripts npm install -g @ionic/app-scripts@latest --save-dev to the latest version and my problem was solved

npm install -g @ionic/app-scripts@latest --save-dev



回答9:


I had the issue, solved by execute cnpm i @ionic/app-scripts.




回答10:


Just open a new terminal window/session. I could not figure it out, but it's probably related to env.




回答11:


None of the options worked for me. But I could make it work by updating node with npm update After this, the problem was solved and the application started. Good Luck.




回答12:


I had the same problem and here is what worked for me

I was trying to run the program using VSCode terminal, Instead I used the windows cmd and it ran perfectly. I think the error is in VSCode terminal, it cannot identify the app-scripts module inside the project. Maybe it will be fixed in a later update.




回答13:


Delete node_modules and package-lock.json

rm -rf node_modules package-lock.json
npm install

Reference: https://github.com/ionic-team/ionic-cli/issues/3399




回答14:


You must create the project as administrator if you have mac or linux uses sudo, if you have windows run the console as administrator and create the project




回答15:


My issue was solved after run this script:

npm i @ionic/app-scripts


来源:https://stackoverflow.com/questions/44381358/error-cannot-find-module-ionic-app-scripts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!