How to include MathJax as a dependency - javascript

I'm trying to include MathJax as a dependency in my bower.json or package.json file. However, I can't find documentation anywhere on how to correctly include it.
I've tried including it like so:
"devDependencies": {
"mathjax": "2.7.5"
}
This does not work.
Does anyone know where I could find this information?

with that you are only including it as a devDependency, basically you installed the package using:
npm install mathjax -D
but what you should do is:
npm install mathjax --save
with that you will be able to use it.

The solution to this issue is to include MathJax in the bower.json file as follows:
"devDependencies": {
"MathJax": "2.7.5"//or replace version number with "latest"
}

Related

The react-scripts package provided by Create React App requires a dependency:

There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"babel-eslint": "9.0.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-eslint was detected higher up in the tree:
create .env file in your project file and add the following statement
SKIP_PREFLIGHT_CHECK=true
Save the file
Remove node_modules, yarn.lock, package.lock
Then reinstall node_modules with
npm install
This should work
I had the same problem and do all the suggested steps but the problem still, so, my error is that i have a reactApp inside other Javascript App i had this structure.
--MyProjects
----NodeJsApp
----node_modules of NodeJsApp
----package.json of NodeJsApp
----ReactApp
------node_modules of ReactApp
------package.json of ReactApp
The problem solved to me deleting my ReactApp node_modules directory, then i do a reestructure of my directories because i have a disaster.
--MyProjects
----NewDirectory (inside all about NodeJsApp)
------node_modules of NodeJsApp
------package.json of NodeJsApp
----ReactApp
------package.json of ReactApp
After that i do :
npm install
and then npm start and my problem has fixed, i think that the problem is that the parent directory cant have a javascript /nodeJs/ project or something that have node_modules .
Part of the output you provided says:
Check if C:\Users\chawki\node_modules\babel-eslint is outside your project directory. For example, you might have accidentally installed something in your home folder.
Browse to C:\Users\chawki\node_modules\ and delete the babel-eslint folder, or simply delete C:\Users\chawki\node_modules.
I just deleted the node_modules folder (for me it was C:\user\[yourUserName]\node_modules\) and re-installed it.
Here What i did...
C:\user\[yourUserName]\node_modules\babel-eslint and delete the file
C:\user\[yourUserName]\node_modules\eslint and delete the file
Delete your eslint and babel-eslint file from your node modules on your computer e.g. -C:\Users\vishnu\node_modules -delete eslint and babel-eslint file.
In your project:
yarn remove eslint
yarn add --dev eslint#6.1.0
yarn remove babel-eslint
yarn add --dev babel-eslint#10.0.3
If you dont want to create .env file there is another alternative you can pass the SKIP_PREFLIGHT_CHECK=true directly in the script.
For Example
"start": "SKIP_PREFLIGHT_CHECK=true react-scripts start",
in package.json
resolutions:{
"babel-eslint": "9.0.0"
}
if you reinstall your all dependencies, you will be forcing "babel-eslint" to be version "9.0.0". if you start your app, you will have no issue.
My problem was I installed webpack as a global package... after i deleted webpact and run npm install, the problem was gone
Make sure you don't have a global webpack package or somewhere higher up the directory structure.
In my case, I had it globally installed. Deleting and then running npm install and then npm start worked perfectly.
Run npm ls babel-eslint and see which dependencies are using it or installing another version. Try updating those libraries.
It worked for me.

Angular 2 library on a private repository

I have to write a library for my app, that can be imported in the other application that I will make. In there will be a lot of functionality related to the get or post with my rest api.
The first think that I have see in google is to publish my code on npm, but I cannot publish there. So I have looked at this example:
How to install an npm package from GitHub directly?
So I have writed my package.json this way:
"dependencies": {
"#angular/animations": "^5.1.0",
...
"myRepo": "git+https://MyUser#git.myRepo.git",
}
And it works,but when I make npm install it download only package.json and readme.md file and nothing else (At the moment in the repo there are a few o file and one directory with one file inside).
Can you help me with this?
Thanks a lot!
My package.json inside the repo that I want to install looks like:
{
name: "myPackage",
version: "1.0.0"
}
And the file in this repo:
directory/
jsfile.js
package.json
readme.md

package.json dependencies exact version not working

This is an excerpt from my package.json:
"dependencies": {
[...]
"jquery": "2.2.3",
[...]
}
According to the package.json documentation ("must match version exactly") it should get jQuery with version 2.2.3 when you do npm install.
So I was surprised when I found that in my node_modules/jquery/dist folder there is a jquery.js file which says: jQuery JavaScript Library v3.0.0 (Which, of course, broke some of my code)
What happened here? Is this a bug? Is this intended behaviour because some other dependency has a jQuery#3.0.0 sub-dependency?
Same occurs when I put the caret in front of the version number ("jquery": "^2.2.3"). Could not find anything about this in the docs, on SO or on google, so any help will be appreciated.
Do you have a npm-shrinkwrap.json file, which makes npm ignore all changes to your package.json dependencies (devDependencies are not affected) and has a hardcoded jquery#3.0.0 version?
Delete that file and run npm install again.
If you need to, run npm shrinkwrap again afterwards to re-create the shrinkwrap file with the new version numbers.
See documentation here: https://docs.npmjs.com/cli/shrinkwrap

how to include a private local file in javascript project using bower

i want to include a custom file as one of the bower dependency.
I am have the following bower.json
{
"name": "xyz",
"version": "0.0.0",
"dependencies": {
"sass-bootstrap": "~2.3.0",
"requirejs": "~2.1.4",
"modernizr": "~2.6.2",
"jquery": "~1.9.1",
"beautify": "file:/path/to/beautify.js"
},
"devDependencies": {}
}
But when i do bower install
it gives error :
bower beautify#* ENOTFOUND Package file:/path/to/beautify.js not found
however when i open the same path in browser i get the right file.
I have also checked the case sensitive of the path.
Now can any one tell me what error i am doing? Is there any thing wrong with the syntax?
Also tell me what if i want to add the same via bower cache. Where the global bower cache is stored in mac? And how can we register the url of private package so that i just need to put name of the package in bower.json and bower finds the file from the cache?
The code below didn't work for me using Bower 1.2.8 on Ubuntu.
"beautify": "/path/to/beautify.js"
What did work was using: "beautify": "./path/to/beautify.js". This way the path is pointing to the file relative from the directory where bower.json resides.
It should be just /relative/path/to/beautify.js. No 'file:/'.
"beautify": "/path/to/beautify.js"
If you have bower installed you can do this from the commandline
bower install ../beautify.js -S
Assuming the local repo is a directory next to your current directory. This is just a testing approach and should be an available repo for general use
EDIT
It looks like you also need to tag your repo so you will pick up the latest changes too
git tag v0.0.2

How to make requirements.txt-like file with bower?

I've started working with bower, and it seems really helpful. I come from a python background, and so I'm used to having virtualenv and requirements.txt.
Since I'd rather not store all my dependencies in source control if I can help it, I was wondering, how can I create a file like requirements.txt with bower?
After poking around a bit more, I have the solution.
bower uses a file called bower.json (formerly component.json) which is similar to a Gemfile or requirements.txt.
It can be created manually, and will look something like this...
{
"name": "<app name, defaults co current folder name>",
"version": "0.0.0",
"dependencies": {
"backbone": "~0.9.10",
"underscore": "~1.4.3"
}
}
However, the piece that I was missing was to include the --save flag when installing packages in bower:
bower install <package_name> --save
Unfortunately, I do not believe there is a way to set this behaviour by default using the .bowerrc file.
As an added tidbit, once you have a bower.json file, installing your dependencies is as simple as running bower install.

Categories