I tried to install MathJax in GitBook with npm install mathjax#2.7.6.
$ npm install mathjax#2.7.6
npm WARN ml No description
npm WARN ml No repository field.
npm WARN ml No license field.
+ mathjax#2.7.6
updated 1 package and audited 1 package in 3.464s
found 0 vulnerabilities
I added the following codes to package.json.
"private": true,
"repository": {
"type": "git",
"url": "git://github.com/mathjax/MathJax.git"
},
Now the situation is,
$ npm install mathjax#2.7.6
+ mathjax#2.7.6
updated 1 package and audited 1 package in 4.6s
found 0 vulnerabilities
However it raised the error if (args[ii] == null) throw missingRequiredArg(ii) while running gitbook install.
info: installing plugin "mathjax-pro"
info: install plugin "mathjax-pro" (*) from NPM with version 0.0.6
C:\Users\SU\.gitbook\versions\3.2.3\node_modules\npm\node_modules\aproba\index.js:25
if (args[ii] == null) throw missingRequiredArg(ii)
^
Error: Missing required argument #1
at andLogAndFinish (C:\Users\SU\.gitbook\versions\3.2.3\node_modules\npm\lib\fetch-package-metadata.js:31:3)
at fetchPackageMetadata (C:\Users\SU\.gitbook\versions\3.2.3\node_modules\npm\lib\fetch-package-metadata.js:51:22)
at resolveWithNewModule (C:\Users\SU\.gitbook\versions\3.2.3\node_modules\npm\lib\install\deps.js:490:12)
at C:\Users\SU\.gitbook\versions\3.2.3\node_modules\npm\lib\install\deps.js:491:7
at C:\Users\SU\.gitbook\versions\3.2.3\node_modules\npm\node_modules\iferr\index.js:13:50
at C:\Users\SU\.gitbook\versions\3.2.3\node_modules\npm\lib\fetch-package-metadata.js:37:12
at addRequestedAndFinish (C:\Users\SU\.gitbook\versions\3.2.3\node_modules\npm\lib\fetch-package-metadata.js:67:5)
at returnAndAddMetadata (C:\Users\SU\.gitbook\versions\3.2.3\node_modules\npm\lib\fetch-package-metadata.js:121:7)
at pickVersionFromRegistryDocument (C:\Users\SU\.gitbook\versions\3.2.3\node_modules\npm\lib\fetch-package-metadata.js:138:20)
at C:\Users\SU\.gitbook\versions\3.2.3\node_modules\npm\node_modules\iferr\index.js:13:50 {
code: 'EMISSINGARG'
}
How do I install MathJax in GitBook?
Related
I have a private dummy project in gitlab which I want to publish to gitlab's package registry. My dummy project contains four files:
package.json
{
"name": "#<my-group>/<my-project>",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://gitlab.com/<my-group>/<my-project>.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://gitlab.com/<my-group>/<my-project>/issues"
},
"homepage": "https://gitlab.com/<my-group>/<my-project>#readme"
}
.gitlab-ci.yml
image: node:latest
stages:
- deploy
deploy:
stage: deploy
script:
- echo "#<my-group>:registry=https://${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/">.npmrc
- echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}">>.npmrc
- npm publish
index.js
console.log('success');
README.md
<my-project>
When I commit my project to gitlab, the job fails with the following output
npm notice package: #<my-group>/<my-project>#1.0.0
npm notice === Tarball Contents ===
npm notice 8B README.md
npm notice 20B index.js
npm notice 612B package.json
npm notice === Tarball Details ===
npm notice name: #<my-group>/<my-project>
npm notice version: 1.0.0
npm notice filename: <my-group>-<my-project>-1.0.0.tgz
npm notice package size: 475 B
npm notice unpacked size: 640 B
npm notice shasum: 7b3db...
npm notice integrity: sha512-xDv0dl9A86...
npm notice total files: 3
npm notice
npm notice Publishing to https://gitlab.com/api/v4/projects/<my-project-id>/packages/npm/ with tag latest and default access
npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://gitlab.com/api/v4/projects/<my-project-id>/packages/npm/#<my-group>%2f<my-project> - insufficient_scope
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy, or
npm ERR! 403 on a server you do not have access to.
NOTE:
I have replaced the actual group name, project name and project id with <my-group>, <my-project>, and <my-project-id> in the code sections above.
I have followed gitlab's official documentation on setting this up (see https://docs.gitlab.com/ee/user/packages/npm_registry/) and believe that I can safely rule out the following:
I have made sure that Package registryis enabled in the project setup
I followed naming convention as described in the documentation
I am using a CI_JOB_TOKEN which should always be valid and should have appropriate permissions.
I made sure that there is no other package with the same name or version within the given scope.
I have made sure that the scoped package's URL includes a trailing slash (see gitlab-ci.yml above)
I have confirmed the path of the <my-group> namespace querying https://gitlab.com/api/v4/groups (just to make sure that the root namespace is correct)
I have used npm init --scope=#<my-group> --yes for initialization
The url of the repository is indeed: https://gitlab.com/<my-group>/<my-project>/
Any help on getting this to work would be much appreciated.
After changing from a job token ${CI_JOB_TOKEN} to a deploy token ${CI_DEPLOY_PASSWORD}, I was able to publish to the registry.
See Predefined variables reference for more info on predefined variables.
Gitlab deploy tokens can be created for projects under Settings > Repository > Deploy tokens with the following scopes: read_repository, read_package_registry, write_package_registry
I was installing a framework called Botonic and i installed perfectly but when I run the
command “botonic new my Bot blank” I get a huge NPM ERR! When it's time to install my dependencies.
~Jhenriqueax🚀: botonic new myBot blank
✔ Downloading files...
✖ Installing dependencies...
Your message must be < 32kb. This is currently surfaced as a warning to allow clients to update. Versions released after August 1, 2018 will throw an error instead. Please update your code before then. {
event: 'Error Botonic CLI',
anonymousId: 87047954,
properties: {
platform: 'darwin',
arch: 'arm64',
timezone: 'America/Fortaleza',
timestamp: '2023-01-18T21:45:38.995Z',
is_tty: true,
framework_path: '/usr/local/lib/node_modules/#botonic/cli/lib',
system_path: '/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/jhenriqueax/Development/flutter/bin:/Library/Apple/usr/bin',
node_version: 'v16.14.2',
botonic_cli_version: '0.20.2',
botonic_dependencies: [ [Array] ],
error_type: 'Installing dependencies: Error: Command failed: CXXFLAGS="--std=c++14" npm install\n' +
'npm WARN deprecated source-map-url#0.4.1: See https://github.com/lydell/source-map-url#deprecated\n' +
Downgrade the node version to 14.16.1
If you're using nvm, try nvm install 14.16.1.
Then use nvm 14.16.1
Make sure you're npm version should be 6.14.12
I'm ok with local dependencies that packages install. But now I have a huge concerns about if a local installed package can install other global packages as dependencies.
as example:
npm install nunjucks
npm install sqlite
or
npm install botkit
It is not possible to mark a dependency as global in package.json, so that it is installed system-wide when you run npm i.
Here's an old comment by Isaac Schlueter stating that this will never be implemented.
Hooowever, it would be really simple to write a preinstall script to install arbitary dependencies globally.
{
"name": "Project",
"version": "1.0.0",
"description": "Preinstall script to install global deps",
"main": "index.js",
"scripts": {
"preinstall": "node -e \"const {execSync} = require('child_process'); JSON.parse(fs.readFileSync('package.json')).globalDependencies.forEach(globalDep => execSync('npm i -g ' + globalDep));\""
},
"dependencies": {
"react": "16.13.1"
},
"globalDependencies": [
"lodash"
],
"license": "ISC"
}
Copy this code into a package.json file in a folder on your PC. Then, in the folder run npm i. It will install React locally (in a node_modules folder) and it will install lodash globally.
You can verify this using: npm i ls -g --depth=0.
Reference: Install dependencies globally and locally using package.json
As to your question:
Can npm -i (local) install a global package without me knowing it?
It's not entirely silent. When running npm i for the above package.json file, you would see the following output:
> Project#1.0.0 preinstall /home/jim/Desktop/Project
> node -e "const {execSync} = require('child_process'); JSON.parse(fs.readFileSync('package.json')).globalDependencies.forEach(globalDep => execSync('npm i -g ' + globalDep));"
npm WARN Project#1.0.0 No repository field.
audited 6 packages in 1.113s
found 0 vulnerabilities
But whether you would catch this when running npm i on a large project is debatable.
I've been following along with a web dev tutorial and I'm stuck at this part: https://btholt.github.io/intro-to-web-dev-v2/libraries#building-your-code
I've been trying for a couple of days to install parcel-bundler and can't figure out what I'm doing wrong. I also tried Prettier and get the same errors. I'm so frustrated and running out of ideas.
I'm running npm 6.14.4 and node 12.16.2.
This is the error npm install -g parcel-bundler in Users/myName (Catalina 10.15):
npm WARN deprecated core-js#2.6.11: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
/Users/myName/.node_modules_global/bin/parcel -> /Users/myName/.node_modules_global/lib/node_modules/parcel-bundler/bin/cli.js
> parcel-bundler#1.12.4 postinstall /Users/myName/.node_modules_global/lib/node_modules/parcel-bundler
> node -e "console.log('\u001b[35m\u001b[1mLove Parcel? You can now donate to our open collective:\u001b[22m\u001b[39m\n > \u001b[34mhttps://opencollective.com/parcel/donate\u001b[0m')"
Love Parcel? You can now donate to our open collective:
> https://opencollective.com/parcel/donate
+ parcel-bundler#1.12.4
updated 1 package in 18.055s
And if I try to run parcel --help I'm told: -bash: parcel: command not found
So I try to fix that first warning. I list the links to the SO articles that I tried at the bottom. I tried deleting node_modules in home directory and doing npm install again. I tried npm install --save core-js#^3. I tried doing a forced clean cache and reinstalling. I tried npm update.
This is my package.json:
{
"name": "generic_package", <-- manually changed from myName
"version": "1.0.0",
"description": "Test description", <-- manually added to remove "no description" error
"main": ".mongorc.js",
"dependencies": {
"core-js": "^3.6.5", <-- looks like it's using >3v
"lodash": "^4.17.15",
"parcel-bundler": "^1.12.4", <-- looks like it's there??
"prettier": "^2.0.4"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "node build/build.js" <-- manually added as per an SO article
},
"keywords": [],
"author": "",
"license": "ISC",
"repository": { <-- manually added this object as per an SO article
"type": "git",
"url": "https://github.com/npm/npm.git",
"private": true <-- manually added as per another SO article
}
}
Error: Please, upgrade your dependencies to the actual version of core-js#3
npm WARN deprecated core-js#2.6.11: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues
npm WARN deprecated core-js#2.6.11
How to update core-js to core-js#3 dependency?
Problems installing express using npm.
The reason for the message npm WARN deprecated core-js#2.6.11: core-js#<3 is no longer maintained is because parcel-bundler has a transitive dependency on core-js#2.6.11, which is no longer supported.
It appears that parcel was installed correctly, so you should be able to run it. On Linux systems, it would have created a symlink under /usr/local/bin/parcel. Make sure that "/usr/local/bin" is in your PATH.
You can also run it as follows:
npm run-script parcel
On newer versions of NPM, you can run this:
npx parcel
I want to use newman for generate reporter in type CSV. When I run the command to install sudo npm install csv
It show warning message like this
npm WARN mycomputer#1.0.0 No description
npm WARN mycomputer#1.0.0 No repository field.
+ csv#5.3.2
updated 1 package and audited 369 packages in 1.785s
2 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
I don't know how to fix it, please help
You need to amend your parkage.json file and add
"description": "",
"repository": {
},
and you can specify the following for repo
"type": "git",
"url": "https://github.com/[parkage].git"