While experimenting with React, I've come across the create-react-app GitHub project. As instructed, I did:
npm install -g create-react-app
create-react-app my-app
cd my-app
The issue here is 'node_modules' folder is full of npm packages rather than having only dependencies.
I'd like to know why this is happening and how can I fix this in order to download only dependencies.
Related
I want to npm install a broken package, i.e., the installation process does not work properly and results in an error. I am used to npm keeping the successfully installed packages in the local node_modules folder. For some reason npm has stopped doing that and removes the node_modules folder if the install is not successful.
How can I tell npm to keep the local node_modules folder regardless of the success or failure of the installation process?
I faced a similar problem when one of the packages failed to build its C++ addon and npm removed node_modules. The below steps helped me:
Install the packages with scripts disabled.
$ npm install --ignore-scripts
Fix the package
...
Rebuild the package
$ npm rebuild PACKAGE
I don't know whats's wrong with my system I am trying to setup expo-cli with yarn global add expo-cli the expo init projectname doesn't work and its getting me same problem when I am trying to install with sudo npm install expo-cli --global?
This is the problem with yarn https://i.stack.imgur.com/q518S.png
&
This is the problem with npm https://i.stack.imgur.com/ojF0h.png
yarn install worked but directory where yarn puts executables for packages is not added to your PATH. If you add it there it should work.
If you want to go with npm, I would strongly recommend to never run npm install with sudo. Use tools like nvm or volta. It will install node, npm and all other packages in your home directory, it should solve all issues with permissions without giving access to your entire system.
https://github.com/nvm-sh/nvm
Try avoiding the global npm install with npx expo-cli
Alternatively, try sudo npm install -g --unsafe-perm expo-cli to install the package globally through root. This seems to be a common error with Ubuntu, more information can be found here: https://github.com/expo/expo-cli/issues/591
So i'm trying to install react native in ubuntu 20.04, and i'm following this guide https://www.techomoro.com/install-and-setup-a-react-app-on-ubuntu/ , but when running "-g create-react-app" the terminal gives me these problems https://imgur.com/a/1tijndK , how do i solve them? i have node and npm installed (see the picture)
You npm version is suitable for this:
npx create-react-app your-app-name
npx command uses create-react-app without downloading it as global.
If you already added the create-react-app globally, uninstall it first.
#issue with npm
Try following command,
npx install create-react-app -g
npx create-react-app my-app
cd my-app
npm start
Sometimes the npm install doesn't work.
https://create-react-app.dev/docs/getting-started/
This seems like a an administrative access issues.
Trying running:
$sudo npx create-react-app my-app
It will ask you for the administrators password, fill that in and it should be up and running.
Upon reinstalling Windows 10 (and Node.js), the gulp command isn't found. I ran it from my root folder containing package.json and the node_modules folder. I tried npm install gulp, and also npm install: gulp command still not found. I'm a bit puzzled.
Any idea?
do you re install node and npm again? when you re install node try with npm install -g gulp
npm install -g gulp will install gulp globally, so that you can use it as a command.
A better way to do it, is to use npm install gulp (without the -g) to install it into each local project, and fire it off using npm start scripts in each project's package.json.
I have a React-Native project and I'm trying to install certain npm modules in my project.
However, when I try to do so from the command line, the packages says it is installed correctly, but it is not appearing in the packages.json dependency.
For instance, I installed react-relay using npm install react-relay.
The package looks to have installed correctly. But I check my packages.json and react-relay is not in there.
I have tried react-native link, and the packages are not coming up.
What is going on?
you would need to use the "save" option: npm install react-relay --save
You need to add save option
npm install react-relay --save
or
npm i react-relay --s
To remove node module from package.json file
npm uninstall react-relay --save
Here is documentation for npm install