Reputation: 475
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
Upvotes: 19
Views: 52274
Reputation: 9444
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
firebase.json
delete "npm --prefix \"$RESOURCE_DIR\" run lint"
Package.json
delete "lint": "eslint .",
(should be within the scripts:)Package.json
delete these devDependencies
"eslint": "^7.6.0",
"eslint-config-google": "^0.14.0"`
npm i
then you should be able to run firebase deploy
Upvotes: 11
Reputation: 1
Editing package.json
from "lint": "eslint .",
to "lint": "eslint",
worked for me.
Upvotes: 0
Reputation: 49
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.
Upvotes: 0
Reputation: 2165
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.
Upvotes: 1
Reputation: 5501
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
Upvotes: 8
Reputation: 61
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.
Upvotes: 6
Reputation: 159
Add this script to your package.json file: "lint": "./node_modules/.bin/eslint ."
Upvotes: 13
Reputation: 73
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.
Upvotes: 0
Reputation: 3121
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"
}
}
Upvotes: 14