Vue3 app breaks when you install anything from npm - node.js

I'm starting a new Vue3 project using vue create delete-me. This seems to work fine, and I can run npm run serve and the app starts up as intended.
As soon as I install any library with NPM, it seems to delete all node_modules and the project no longer works.
Now install anything and this is the result:
I've tried running npm install afterwords but the project does not seem to have all the dependencies. The project is just useless at this point.
It seems like vue create does not create a valid package.json but not sure. I'm new to Node and Vue.

Related

Issue with NPM start ( React)

I have just tried to view an old application of mine using npm start but it wont load keep getting the error.
Cannot find module 'C:\Users\Team Knowhow\development\Punk-API\node_modules\react-scripts\bin\react-scripts.js.
I tried creating a new react app and NPM start works fine so have no idea what the issue is with my old react app and why NPM start does not work.
Have you installed dependencies first using npm install.
If done already, try removing node_modules folder and installing dependencies again.
Make sure you have installed all dependencies including react-scripts!
You've to ensure that all the dependencies that your application is using is mentioned in the correct manner with their correct version in your pacakage.json file. And if that looks alright then run
npm i
or
npm install
This command will download all the dependencies that are mentioned in your package.json file.

"npm run build" Command in an Express App Colliding on Imports with Typescript and React Native

I have an Express app that I build and run using npm run serve which I define in my package.json scripts serve section as: 'npm run build && node lib/index.js'. Recently, I installed React Native for another project, however, when I return to my express project and attempt to build it with npm run build, I recieve multiple duplicate declaration errors in the terminal:
React Native is not defined anywhere in my Express project, when I examine my node modules, there is no react-native package even installed. Before installing React Native in another project this command worked fine, the Express project has not been changed since it last compiled succefully.
Thanks #TheGreatZab for testing it out.
Post the answer here to help anyone who are suffering from this problem.
The reason is an extra node_modules/package.json exist in grand parent directories which trigger the butterfly effects.
Solution:
Remove the node_modules, package.json from parent/grand parent directories

React Native: Unable to resolve a local module. Exists in Node Modules

I'm working on an app that both has a website (React) and mobile app (React Native). In one repository I have my web, mobile and redux files which is my local module/package (so that they can be shared). I have not had any problems with installing my local package when working on web. However with React Native I am running into issues with the package.
I ran
npm install --save '../store/sagas
Which gave me
Unable to resolve "redux-saga-store/sagas/index.js" from "App.js"
Fair. App.js is where I am calling my rootSaga via
import rootSaga from 'redux-saga-store/sagas/index.js';
Which is identical to how web is calling the same file.
I checked my node_modules and the package and all the expected files are there. I tried
npm list
Which returned (as expected)
redux-saga-store#1.0.0 -> /Users/{myname}/Repos/{repositoryname}/shared/store
I have triple-checked the paths and they are correct.
I tried npm install with the global flag. I went on to nuking my node_modules and package-lock.json so I could try re-installing. I created a brand new react-native app using create-react-native-app which also did not fix the issue. I would really appreciate any suggestions or help

How to get Started with Ember on windows using npm?

C:\Users\andri>cd ember-cli
Das System kann den angegebenen Pfad nicht finden.
C:\Users\andri>npm install -g bower
npm WARN deprecated bower#1.8.2: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
C:\Users\andri\AppData\Roaming\npm\bower -> C:\Users\andri\AppData\Roaming\npm\node_modules\bower\bin\bower
+ bower#1.8.2
added 1 package in 23.177s
C:\Users\andri>ember new testapp-app
installing app
create .editorconfig
create .ember-cli
create .eslintrc.js
create .travis.yml
create .watchmanconfig
create README.md
create app\app.js
create app\components\.gitkeep
create app\controllers\.gitkeep
create app\helpers\.gitkeep
create app\index.html
create app\models\.gitkeep
create app\resolver.js
create app\router.js
create app\routes\.gitkeep
create app\styles\app.css
create app\templates\application.hbs
npm: Installed dependencies
Successfully initialized git.s
C:\Users\andri>ember server
node_modules appears empty, you may need to run `npm install`
C:\Users\andri>bower install
bower ENOENT No bower.json present
C:\Users\andri>ember server
node_modules appears empty, you may need to run `npm install`
I am trying to install ember and keep getting errors. Does anybody understand what I am doing wrong? I am watching a youtube tutorial and I follow the steps that are on the video, still it doesnt work, in fact I get totally different results :/ I have also installed git.. Could somebody explain to me what is happening here? I am very new to all these and therefore I cannot spot the mistakes. Thank you in advance
For Windows Users:::
Install Node js for windows and then install npm package for it and if you have done that.
You can install ember from npm.
Install Ember using npm:
npm install -g ember-cli#3.0
To verify that your installation was successful, run:
ember -v
If a version number is shown, you're ready to go.
see the link below for more details...
https://guides.emberjs.com/v3.0.0/getting-started/
looking your prompt, to start a ember server, just go to your ember app folder (cd\testapp-app) and use ember serve or ember s
Your last error there is telling you what's missing.
node_modules appears empty, you may need to run npm install
Running npm install in the project folder and then running ember server should get you up and running. The default URL is http://localhost:4200 when ember-cli has spun up the server.

Does react-native init downloads package every time?

I recently started learning react-native also I am new to node and npm. When I create a new react-native project I noticed that it takes really long time for every project.
Shouldn't it be like after initialization of first project it should cache the downloaded packages and use it when I create other projects?
I looked at the option to install react-native globally as npm install -g react-native but then it throws error saying react-native is installed globally.
Every time you initialise new project by react-native-cli (probably you have it installed globally) you create plain new directory with package.json and some additional starting files. After that in this directory is fired command npm install which fetches and install all modules defined in pakcage.json and put in ./node_modules/.
If you like to have npm install step cached try to find out how to cache certain modules: https://docs.npmjs.com/cli/cache

Resources