'my npm-lint is throwing error "missing script: lint"
I am trying to run npm run locally, and ran npm init, that created package.json. Here is my package.json
"name": "ironic-ui",
"version": "1.0.0",
"description": "======================== Team and repository tags ========================",
"main": "test-shim.js",
"directories": {
"doc": "doc"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://git.openstack.org/openstack/ironic-ui"
},
"author": "",
"license": "ISC"
}
Is there missing something? Or do i need to install something more? I am getting an error "Missing script: lint" Thanks
Solution 1:[1]
You need to setup linter and add lint command in your package.json Many linter are available. Assuming you setup eslint https://www.npmjs.com/package/eslint
it would look something like this
// package.json
{
//...
"scripts": {
"lint": "eslint.js"
}
}
Solution 2:[2]
Add this script to your package.json file: "lint": "./node_modules/.bin/eslint ."
Solution 3:[3]
Should not be removing eslint, instead should try to configure it to make it work to your preferences.
However, if you need to remove it because of time or other constraint
- From
firebase.jsondelete"npm --prefix \"$RESOURCE_DIR\" run lint" - From
Package.jsondelete"lint": "eslint .",(should be within the scripts:) - Also from
Package.jsondelete thesedevDependencies
"eslint": "^7.6.0",
"eslint-config-google": "^0.14.0"`
- Delete this file from repo `.eslintrc.js
- Then run
npm i
then you should be able to run firebase deploy
Solution 4:[4]
I got the same problem.
I deleted functions folder, .firebaserc and firebase.json.
Then reinstalled firebase-tools
npm install -g firebase-tools
After firebase init, chose functions, it asked
Do you want to use ESLint to catch probable .....?.
I typed No.
It worked fine for me.
Solution 5:[5]
If you want to remove eslint from your Firebase Functions project, you can go to firebase.json and delete the line npm --prefix \"$RESOURCE_DIR\" run lint (inside predeploy). After this, you can delete the .eslintrc.json file inside your functions project
Solution 6:[6]
I get the exact same problem when I do: firebase deploy --only functions (-- only functions is optional), it redirects me to
npm --prefix %RESOURCE_DIR% run lint
It worked fine for me when I removed lint, thus having:
npm --prefix %RESOURCE_DIR% run
only.
Solution 7:[7]
I ran into this issue when after setting up a firebase functions project inside a project that already had a firebase function elsewhere. It seems that firebase init doesn't necessarily know which project to set as "source" in firebase.json.
In my case, firebase.json simply pointed to the wrong source dir. I corrected it to point the my intended directory - issue solves.
Note: In my case, linting was desired, so removing linting was not the solution.
Solution 8:[8]
For me i was just running the command without entering the function folder so it was not finding it i was just running this function on the project folder. So run cd function in your cmd if your are just in the project folder then run the command again but if the script is not in your package.json as mentioned above or you said no to eslint/lint when you initialized your firebase project lint wont work but others command that exist in your scripts work.
Solution 9:[9]
Editing package.json from "lint": "eslint .", to "lint": "eslint", worked for me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | mafiurs |
| Solution 3 | iDecode |
| Solution 4 | TsaiKoga |
| Solution 5 | |
| Solution 6 | Ziad |
| Solution 7 | Jefftopia |
| Solution 8 | Abrham Daniel |
| Solution 9 | FluxedScript |
