I am trying to add linting for SugarSS to my project. I've added lint-staged command to my package.json:
"scripts": {
"lint-staged": "$(yarn bin)/lint-staged"
},
"lint-staged": {
...
"app/assets/styles/**/*.sass": [
"prettier --write",
"stylelint --fix --syntax sugarss",
"git add"
]
}
When I run npm run lint-staged it outputs
✖ prettier --write found some errors. Please fix them and try committing again.
[error] path/to/style.sass: SyntaxError: Unexpected token, expected ";" (3:16)
[error] 1 | h1.question
[error] 2 | overflow: visible
[error] > 3 | padding-right: 12px
[error] | ^
[error] 4 | color: #333
[error] 5 |
[error] 6 | #questions h4
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my_project#1.0.0 lint-staged: `$(yarn bin)/lint-staged`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my_project#1.0.0 lint-staged script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Seems like that eslint tries to lint my path/to/style.sass with the new SASS 3 syntax
How can I set up linting for SugarSS syntax in package.json? Thanks
I was able to set up linting for SugarSS with the following setup:
# .stylelintrc
{
"extends": "stylelint-config-sugarss-recommended"
}
And in package.json
{
"devDependencies": {
"stylelint-config-sugarss-recommended": "^1.1.0"
...
},
"scripts": {
"lint-staged": "$(yarn bin)/lint-staged"
},
"lint-staged": {
"app/assets/styles/**/*.sass": [
"stylelint --fix --syntax sugarss",
"git add"
],
...
},
"pre-commit": [
"lint-staged"
]
}
Related
I am trying to deploy a backend onto Render but i am geting erros below. And I also have a postgresql on Supabase.
Dec 31 02:26:57 PM sh: 1: rimraf: not found
Dec 31 02:26:57 PM npm ERR! code ELIFECYCLE
Dec 31 02:26:57 PM npm ERR! syscall spawn
Dec 31 02:26:57 PM npm ERR! file sh
Dec 31 02:26:57 PM npm ERR! errno ENOENT
Dec 31 02:26:57 PM npm ERR! backend#1.0.0 build: `rimraf ./dist && npm run generate && tsc`
Dec 31 02:26:57 PM npm ERR! spawn ENOENT
Dec 31 02:26:57 PM npm ERR!
Dec 31 02:26:57 PM npm ERR! Failed at the backend#1.0.0 build script.
Dec 31 02:26:57 PM npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Dec 31 02:26:57 PM
Dec 31 02:26:57 PM npm ERR! A complete log of this run can be found in:
But as my package.json file below shows i have rimraf.
{
"name": "backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start:dev": "nodemon src/index.ts --watch ./**/*.ts --exec ts-node src/index.ts",
"build": "rimraf ./dist && npm run generate && tsc",
"start": "node dist/index.js",
"generate": "npm run generate:prisma",
"generate:prisma": "prisma generate && prisma migrate deploy"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"#prisma/client": "^4.7.1",
"apollo-server": "^3.9.0",
"graphql": "^16.5.0"
},
"devDependencies": {
"prisma": "^4.8.0",
"rimraf": "^3.0.2",
"ts-node-dev": "^2.0.0",
"typescript": "^4.7.4"
}
}
I tried deploying with postgresql is on Supabase and in env variables I have that url and production for graphql.
const server = new ApolloServer({
typeDefs,
resolvers,
csrfPrevention: true,
cache: 'bounded',
plugins: [
process.env.NODE_ENV === "production"
? ApolloServerPluginLandingPageProductionDefault({ footer: false })
: ApolloServerPluginLandingPageLocalDefault({ footer: false }),
],
context: ({ req }) => {
return {
...req,
prisma,
// userId: req && req.headers.authorization ? getUserId(req) : null,
};
},
});
server.listen().then(({ url }) => {
console.log(`server is on ${url}・・・`);
});
it is resoleved. It was because of variables set to "production".
In windows, when I run the command "npm run serve" in command prompt for viewing my vue js project it is showing some errors
C:\Users\HOME\app>npm run serve
npm ERR! Missing script: "serve"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HOME\AppData\Local\npm-cache\_logs\2021-11-15T17_29_32_459Z-debug.log
The package.json of this is:
{
"name": "testapp",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"node": "^16.4.1",
"register-service-worker": "^1.7.1",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vuex": "^3.4.0"
},
"devDependencies": {
"#vue/cli-plugin-pwa": "~4.5.0",
"#vue/cli-plugin-router": "~4.5.0",
"#vue/cli-plugin-vuex": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"vue-template-compiler": "^2.6.11"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
Please help, I am having this issue while deploying my nextjs app in Heroku, the app runs fine locally.
Below is the log from Heroku and my package.json file.
Log:
2021-08-13T07:26:20.752659+00:00 app[web.1]:
2021-08-13T07:26:20.752685+00:00 app[web.1]: > # start /app
2021-08-13T07:26:20.752688+00:00 app[web.1]: > next start -p $PORT
2021-08-13T07:26:20.752689+00:00 app[web.1]:
2021-08-13T07:26:20.763505+00:00 app[web.1]: sh: 1: next: not found
2021-08-13T07:26:20.769117+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-08-13T07:26:20.769496+00:00 app[web.1]: npm ERR! syscall spawn
2021-08-13T07:26:20.769568+00:00 app[web.1]: npm ERR! file sh
2021-08-13T07:26:20.769636+00:00 app[web.1]: npm ERR! errno ENOENT
2021-08-13T07:26:20.772506+00:00 app[web.1]: npm ERR! # start: `next start -p $PORT`
2021-08-13T07:26:20.772533+00:00 app[web.1]: npm ERR! spawn ENOENT
package.json:
{
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start -p $PORT"
},
"dependencies": {
"#heroicons/react": "^1.0.3",
"next": "latest",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"tailwind-scrollbar-hide": "^1.0.3"
},
"devDependencies": {
"autoprefixer": "^10.2.6",
"postcss": "^8.3.5",
"tailwindcss": "^2.2.4"
}
}
Trying to make css files from scss with node-sass.
My package.json:
{
"name": "hello-webpack",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"scss": "node-sass -watch scss -o css"
},
"author": "",
"license": "ISC",
"devDependencies": {
"sass": "^1.26.10",
"sass-loader": "^9.0.3",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.11"
},
"dependencies": {
"node-sass": "^4.14.1"
}
}
But when i try npm run scss i see this error:
> node-sass -watch scss -o css
internal/validators.js:120
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at validateString (internal/validators.js:120:11)
at Object.extname (path.js:1229:5)
at getOptions (/Users/mac/Documents/Website/node_modules/node-sass/bin/node-sass:192:40)
at Object.<anonymous> (/Users/mac/Documents/Website/node_modules/node-sass/bin/node-sass:376:15)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'ERR_INVALID_ARG_TYPE'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hello-webpack#1.0.0 scss: `node-sass -watch scss -o css`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hello-webpack#1.0.0 scss script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mac/.npm/_logs/2020-08-20T14_02_52_371Z-debug.log
What's wrong with path? It's correct, i got directories scss & css, and have some files in both.
You're using the watch option with the full name which requires 2 dashes:
node-sass scss --watch -o css
Otherwise use 1 dash with the shorthand w name:
node-sass scss -w -o css
https://www.npmjs.com/package/node-sass#command-line-interface
I'm trying to do that by watching the video. but I get an error at 09:40 minutes in the video.
Here is the video link
I am running this command in the terminal; npm run json:server and I get the following error.
My terminal error:
C:\Users\Yavuz\Desktop\JSONSERVER>npm run json:server
> jsonserver#1.0.0 json:server C:\Users\Yavuz\Desktop\JSONSERVER
> json-server --watch db.json
module.js:540
throw err;
^
Error: Cannot find module 'color-convert'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\Yavuz\Desktop\JSONSERVER\node_modules\ansi-styles\index.js:2:22)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! jsonserver#1.0.0 json:server: `json-server --watch db.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the jsonserver#1.0.0 json:server script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Yavuz\AppData\Roaming\npm-cache\_logs\2018-04- 13T21_32_40_798Z-debug.log
package.json
{
"name": "jsonserver",
"version": "1.0.0",
"description": "Fake REST API for testing",
"main": "index.js",
"scripts": {
"json:server": "json-server --watch db.json"
},
"author": "",
"license": "ISC",
"dependencies": {
"json-server": "^0.12.1"
}
}
db.json
{
"users":[
{
"id":"1",
"firstName":"John",
"lastName":"Doe",
"email":"john#gmail.com",
"age":34,
"companyId":"1"
},
{
"id":"2",
"firstName":"Mark",
"lastName":"Doe",
"email":"mark#gmail.com",
"age":32,
"companyId":"2"
}
],
"companies":[
{
"id":"1",
"name":"Apple",
"description":"This is very good firm."
},
{
"id":"2",
"name":"Microsoft",
"description":"This is good firm."
}
]
}
Looks like you are missing the color-convert module. Try running npm install --save color-convert. This module will be added in your package.json as a dependency.