I came across d3ML.js. However, it's not in the npm registry so I can't directly install it. Is there any other to install & use it in a React.js project?
Related
When using npx create-react-app my-app, I got this error:
You are running create-react-app 4.0.3, which is behind the latest release (5.0.1).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
I used the command npm uninstall and also check out the getting started with react
but that links suggest the same process
of npx create-react-app my-app. I also used this command npm install react react-dom but this
only install a node modules and a package.json. It doesn't create the usual react boilerplate
and all. Anyone have any idea, please help.
Try this solution :
npx create-react-app#latest myApp
You first need to uninstall the glocal app and then clear the cache and then reinstall it.
npm uninstall -g create-react-app
npx clear-npx-cache
After doing this reinstall it by running following command
npx create-react-app my-app
If it still don't work make sure to update your npm and node version.
If you want to update the react and react-dom of the existing app to the latest version you can do it by following running the following code.
npm install --save react#latest
npm install --save react-dom#latest
If you want to download a specific version of react and react-dom then you can run the following code in your terminal.
npm install --save react#<version>
npm install --save react-dom#<version>
You need to replace with your desired version for example
npm install --save react#17
I have installed few npm packages globally but it does not show any dependencies in any of my package.json files. Which npm command should I use to apply dependencies in all of my package.json files?
Globally installed dependencies won't list in your local package.json file. You should still be able to use them requiring/importing into your project.
if you want to save a dependency in your package.json as well when you install it, us --save flag with npm install command.
for example
npm install --save express
It is not recommended to add a package which is installed globally to locally or vice versa.
When a package is installed globally, it is normally used as a command in the terminal. For example, create-react-app or express-generator. You might install these packages globally to use them as commands in the terminal to build React or Express app (with default scaffold).
When a package is installed locally, it means you want to use it within the application. For example, jsonwebtoken. You should install this package locally so that it can be used within the application and when somebody else clones your project they can install this package as well via npm install command.
So, the suggestion is, install the package globally if you're going to use it as a command, else install the package locally within the application. Don't mix them.
I'm working on an expo project. We have to use expo install when adding other expo libraries (e.g. expo-permissions, expo-av). But we can also use expo install for non-expo libraries (e.g. react-native-root-toast). So, is it safe to use expo install for all libraries that we install?
Yes, there is nothing wrong with using it to install all of your dependencies. All expo install does is check for compatibilities with your current expo version.
From expo docs:
The expo install command will pick a version that is compatible with your project and then use your JavaScript package manager (such as npm) to install it.
So if you use yarn instead of npm for example, expo will use yarn instead.
I was looking at this link Use different registries in yarn and npm
So let's say I want to use my own version some npm package called package instead of installing it using
yarn add package
If my folder path is C:/custom-package
I tried to put in my .yarnrc something like registry "https://package.dev/repository/npm-proxy/" "C:/custom-package/
Then run yarn add package
Still didn't work, it installs the normal package as if I'm using yarn add package
So the question is: How can I do that, what am I missing?
I am trying to create Angular2 project using angular-cli. I run, npm install -g angular-cli then I ng new test, it returns
"'ng' is not recognized as an interal or external command, operable
program or batch file."
I check the directory, C:\node\node_modules\npm\node_modules. There was not angular-cli found. My npm version is 4.0.2 and my node version is 5.11.0. If you guys have same problem, could you help me how to figure this out?
From angular-cli docs
Prerequisites
Both the CLI and generated project have dependencies that require Node
6.9.0 or higher, together with NPM 3 or higher.
You need to upgrade your node and npm first.
1) As VadimB suggested, you need to upgrade node and npm versions. Install latest version of node from nodejs.org and make sure you choose minimum Node 6.9.0 setup.
2) You are trying to run wrong command.
Current version command is - npm install -g #angular/cli (Please note - # before angular/cli package in above command.)
3) After #angular/cli installation, you can use ng help or ng -v to check successful installation and version.
4) You are looking at wrong folder. Once installed successfully, #angular\cli will be available in C:\Users\<UserName>\AppData\Roaming\npm\node_modules\
Installing Angular Dependencies
Install a stable version of Node (if not already installed) and verify the installation using node -v
Install TypeScript using command npm install -g typescript
Download and install Angular CLI using command npm install -g #angular/cli
Angular is a component oriented framework. Many components needs to be created to make the whole application. A component is a group of custom elements, HTML elements, ShadowDOM & HTML imports.
Creating the Angular 4 app using Angular CLI
To create a fresh new Angular 4 app, use command ng new newAppName. This command takes some time to execute.
package.json - takes care of the development and app dependencies / packages / commands to execute
src\main.ts - takes care of the scaffolding the entire
src\app\app.module.ts - any newly created module has to added to the declarations and services has to be provided to the providers key parameter of the function #NgModule to make them accessible across the entire application
Run the Angular 4 app using Angular CLI
To run the freshly created app using CLI, use command ng serve which will run the app on http://localhost:4200/.
Use this code :
npm install -g #angular/cli