Yesterday, I was able to setup a starter-pack instance of gatsby and deploy to github pages.
Since then, I've updated my react/js files locally, which seemed to run fine locally. Now I want to compile my sass:
I can't find a decent solution which works:
Here's the sass compiler I tried to install:
sass --watch assets/scss/main.scss:assets/css/style.css
Node sass watch runs, but doesn't actually compile anything. I get an error instead:
Problems:
1) Since installing the sass
./src/assets/scss/main.scss
Module parse failed: /Users/reenaverma/development/GATSBY/src/assets/scss/main.scss Unexpected character '#' (1:8)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '#' (1:8)
at Parser.pp$4.raise (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp$7.getTokenFromCode (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:2756:10)
at Parser.pp$7.readToken (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:2477:17)
at Parser.pp$7.nextToken (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:2468:15)
at Parser.pp$7.next (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:2413:10)
at Parser.pp.eat (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:536:12)
at Parser.pp$1.parseStatement (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:728:71)
at Parser.pp$1.parseTopLevel (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:638:25)
at Parser.parse (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:516:17)
at Object.parse (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:3098:39)
at Parser.parse (/Users/reenaverma/development/GATSBY/node_modules/webpack/lib/Parser.js:902:15)
at NormalModule.<anonymous> (/Users/reenaverma/development/GATSBY/node_modules/webpack/lib/NormalModule.js:104:16)
at NormalModule.onModuleBuild (/Users/reenaverma/development/GATSBY/node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10)
at nextLoader (/Users/reenaverma/development/GATSBY/node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25)
at /Users/reenaverma/development/GATSBY/node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5
at Storage.finished (/Users/reenaverma/development/GATSBY/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16)
at /Users/reenaverma/development/GATSBY/node_modules/graceful-fs/graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:528:3)
# ./src/layouts/index.js 29:0-35
2) I've even tried this link, but this doesn't work either:
https://www.npmjs.com/package/gatsby-plugin-sass
3) For some reason, I also can't deploy to Github/git push origin master / npm run deploy
error: ./src/assets/scss/main.scss
Module parse failed: /Users/reenaverma/development/GATSBY/src/assets/scss/main.scss Unexpected character '#' (1:8)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '#' (1:8)
at Parser.pp$4.raise (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp$7.getTokenFromCode (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:2756:10)
at Parser.pp$7.readToken (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:2477:17)
at Parser.pp$7.nextToken (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:2468:15)
at Parser.pp$7.next (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:2413:10)
at Parser.pp.eat (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:536:12)
at Parser.pp$1.parseStatement (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:728:71)
at Parser.pp$1.parseTopLevel (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:638:25)
at Parser.parse (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:516:17)
at Object.parse (/Users/reenaverma/development/GATSBY/node_modules/acorn/dist/acorn.js:3098:39)
at Parser.parse (/Users/reenaverma/development/GATSBY/node_modules/webpack/lib/Parser.js:902:15)
at NormalModule.<anonymous> (/Users/reenaverma/development/GATSBY/node_modules/webpack/lib/NormalModule.js:104:16)
at NormalModule.onModuleBuild (/Users/reenaverma/development/GATSBY/node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10)
at nextLoader (/Users/reenaverma/development/GATSBY/node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25)
at /Users/reenaverma/development/GATSBY/node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5
at Storage.finished (/Users/reenaverma/development/GATSBY/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16)
# ./src/layouts/index.js 28:0-35
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gatsby-starter-default#1.0.0 deploy: `gatsby build --prefix-paths && gh-pages -b master -d public`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gatsby-starter-default#1.0.0 deploy 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/reenaverma/.npm/_logs/2018-05-30T13_34_31_289Z-debug.log
PLEASE HELP! I need this sorted by tonight:
Here's my code from yesterday.... But I have updated 3 js files. But this works locally. Seems trying to run sass is breaking my work:
https://github.com/ReenaVerma/reenaverma.github.io/tree/master
The following 2 steps has helped me:
1) run npm install gatsby-plugin-sass to download sass plugin for Gatsby;
2) add gatsby-plugin-sass to plugins section of the gatsby-config.json file.
Related
I've read the million threads with the same issue but I couldn't solve it :(
This is an old project I made and I need to access to it again but I'm getting the following error when running npm start:
> express-typescript-starter#0.1.0 start
> npm run tsc && npm run serve
> express-typescript-starter#0.1.0 tsc
> tsc
> express-typescript-starter#0.1.0 serve
> ts-node src/server.ts
{"level":"debug","message":"Logging initialized at debug level"}
C:\Users\alan_\Desktop\cdng\mern-finance-server-master\node_modules\passport-jwt\lib\strategy.js:45
throw new TypeError('JwtStrategy requires a secret or key');
^
TypeError: JwtStrategy requires a secret or key
at new JwtStrategy (C:\Users\alan_\Desktop\cdng\mern-finance-server-master\node_modules\passport-jwt\lib\strategy.js:45:15)
at Object.<anonymous> (C:\Users\alan_\Desktop\cdng\mern-finance-server-master\src\config\passport.ts:6:28)
at Module._compile (node:internal/modules/cjs/loader:1149:14)
at Module.m._compile (C:\Users\alan_\Desktop\cdng\mern-finance-server-master\node_modules\ts-node\src\index.ts:858:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1203:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\alan_\Desktop\cdng\mern-finance-server-master\node_modules\ts-node\src\index.ts:861:12)
at Module.load (node:internal/modules/cjs/loader:1027:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Module.require (node:internal/modules/cjs/loader:1051:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (C:\Users\alan_\Desktop\cdng\mern-finance-server-master\src\app.ts:16:1)
at Module._compile (node:internal/modules/cjs/loader:1149:14)
at Module.m._compile (C:\Users\alan_\Desktop\cdng\mern-finance-server-master\node_modules\ts-node\src\index.ts:858:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1203:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\alan_\Desktop\cdng\mern-finance-server-master\node_modules\ts-node\src\index.ts:861:12)
at Module.load (node:internal/modules/cjs/loader:1027:32)
This is src/config/passport.ts:
import passport from 'passport'
import { Strategy as JwtStrategy, ExtractJwt } from 'passport-jwt'
import userServices from '../services/userServices'
import { JWT_SECRET } from '../util/secret'
export const jwtStrategy = new JwtStrategy(
{
secretOrKey: JWT_SECRET,
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
},
async (payload: any, done: any) => {
const userEmail = payload.email
const foundUser = await userServices.findUserByEmail(userEmail)
done(null, foundUser)
}
)
When running "npm i" I'm getting a bunch of errors as well but I could --force it:
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: jest-config#27.5.1
npm WARN Found: ts-node#8.10.2
npm WARN node_modules/ts-node
npm WARN dev ts-node#"^8.6.2" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peerOptional ts-node#">=9.0.0" from jest-config#27.5.1
npm WARN node_modules/jest-config
npm WARN jest-config#"^27.5.1" from #jest/core#27.5.1
npm WARN node_modules/#jest/core
npm WARN 1 more (jest-cli)
npm WARN
npm WARN Conflicting peer dependency: ts-node#10.9.1
npm WARN node_modules/ts-node
npm WARN peerOptional ts-node#">=9.0.0" from jest-config#27.5.1
npm WARN node_modules/jest-config
npm WARN jest-config#"^27.5.1" from #jest/core#27.5.1
npm WARN node_modules/#jest/core
npm WARN 1 more (jest-cli)
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: ts-jest#26.5.6
npm ERR! Found: jest#27.5.1
npm ERR! node_modules/jest
npm ERR! dev jest#"^27.5.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer jest#">=26 <27" from ts-jest#26.5.6
npm ERR! node_modules/ts-jest
npm ERR! dev ts-jest#"^26.5.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: jest#26.6.3
npm ERR! node_modules/jest
npm ERR! peer jest#">=26 <27" from ts-jest#26.5.6
npm ERR! node_modules/ts-jest
npm ERR! dev ts-jest#"^26.5.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
You can see the whole repo here.
Thanks!
I'm not going to attempt to fix your conflicts, but npm i -force will allow everything to be installed.
You will also need to place a .env file in the root and ensure it has a JWT_SECRET secret value.
There are also a lot of other .env values required. Your .env should look like this (or production):
JWT_SECRET = 'jhagdhjwf'
MONGODB_URI = 'mongodb://localhost:27017/local'
PORT = 3000
CLOUD_NAME = 'Your cloud name'
CLOUDINARY_API_KEY = '123123123123'
CLOUDINARY_API_SECRET = 'abc123abc123abc123abc123'
NODE_ENV = 'production'
I don't know why you didn't think an .env was not required. I thought you said this was your project?
As you will also know, you have to have cloudinary API config and also a running mongodb server, on which you store your data.
Eg, install docker and run the command to get a quick running local version:
docker run -d -p 27017:27017 --name test-mongo mongo:latest
I did a pull of the code and everything works locally. Add this .env and it will work:
> express-typescript-starter#0.1.0 start
> npm run tsc && npm run serve
> express-typescript-starter#0.1.0 tsc
> tsc
> express-typescript-starter#0.1.0 serve
> ts-node src/server.ts
{"level":"debug","message":"Logging initialized at debug level"}
(node:78699) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
App running on port 3000
Opening http://localhost:3000/api/v1/users will give you the expected [] response. I assume you have a front end somewhere.
Everything should be working as expected.
Extra: Your import { JWT_SECRET } from '../util/secret' is not the right file name. In your repo it is https://github.com/AlanFPS/mern-finance-server/blob/master/src/util/seccret.ts. Your import is looking for secret but your file is called seccret (two c's).
I have an issue with node v10.15.1 and npm v6.14.15
Running npm install into the root folder of a project, I have the following error:
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="GitHub"
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/myuser/.npm/_logs/2022-08-10T17_31_09_840Z-debug.log
The log file reports this:
2675 verbose stack Error: Unable to authenticate, need: Basic realm="GitHub"
2675 verbose stack at res.buffer.catch.then.body (/Users/myuser/.nvm/versions/node/v10.15.1/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:107:17)
2675 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7)
2676 verbose statusCode 401
2677 verbose pkgid socket.io-client#https://github.com/substack/socket.io-client/tarball/master
2678 verbose cwd /Users/myuser/myproject
2679 verbose Darwin 20.6.0
2680 verbose argv "/Users/myuser/.nvm/versions/node/v10.15.1/bin/node" "/Users/myuser/.nvm/versions/node/v10.15.1/bin/npm" "install"
2681 verbose node v10.15.1
2682 verbose npm v6.14.15
2683 error code E401
2684 error Unable to authenticate, need: Basic realm="GitHub"
2685 verbose exit [ 1, true ]
I have other projects that compile perfectly with node v10.15.1 and npm v6.14.15
Any help will be appreciated.
Thanks
I solved this problem by myself.
If you have a similar issue, check in your npm configurations if you have the option always-auth=true, typing:
npm config list
In my case, I had :
; userconfig /Users/myuser/.npmrc
always-auth = true
In order to bypass this problem, create a .npmrc file in the root folder of your project and force the property to false:
always-auth = false
Now, npm config list should show you something like this:
; project config /Users/myuser/myproject/.npmrc
always-auth = false
With this configuration you should solve the E401 Basic realm="GitHub"
I try to execute the node kline command, but it gives me an error:
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'C:\Program Files\nodejs\kline'
←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:725:27)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m
←[90m at internal/main/run_main_module.js:17:47←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: []
}
Although npm install kline was successful. Tell me, maybe I missed something.
From what I gathered the kline module doesn't seem to be designed for the command line. Besides this to install a package which should run from the command line, e.g. nodemon, you should add the -g flag to the npm install command. This will install your package in the global npm scope which also supports calling these packages as a command, if supported.
I am trying to run plutus-playground-client, but I get this error when I run npm run start
[nix-shell:~/dev/plutus/plutus-playground-client]$ npm run start
> plutus-playground-client#1.0.0 start /Users/danicuki/dev/plutus/plutus-playground-client
> npm install && plutus-playground-generate-purs && npm run purs:compile && npm run webpack:server
npm WARN ajv-errors#1.0.1 requires a peer of ajv#>=5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ajv-keywords#3.5.2 requires a peer of ajv#^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN monaco-emacs#0.2.2 requires a peer of monaco-editor#^0.14.0 || ^0.15.0 || ^0.16.0 || ^0.17.0 || ^0.18.0 || ^0.19.3 || ^0.20.0 but none is installed. You must install peer dependencies yourself.
npm WARN plutus-playground-client#1.0.0 No repository field.
audited 752 packages in 3.101s
42 packages are looking for funding
run `npm fund` for details
found 5 vulnerabilities (2 moderate, 3 high)
run `npm audit fix` to fix them, or `npm audit` for details
[Info] Running: (Nothing,PSGenerator {_outputDir = "generated"})
Successfully created your servant API purescript functions!
Please make sure you have purescript-servant-support version 5.0.0 or above installed:
bower i --save purescript-servant-support
The following purescript packages are needed by the generated code:
- plutus-playground-client
- purescript-either
- purescript-foreign-generic
- purescript-maybe
- purescript-ordered-collections
- purescript-profunctor-lenses
- web-common
Successfully created your PureScript modules!
plutus-playground-server: user error (Error evaluating simulation: InterpreterError (CompilationErrors [CompilationError {filename = "\n/private/tmp/web-ghc-work-f7221c0023582e5f/Main.hs", row = 2, column = 1, text = [" error:"," Could not load module \8216Playground.Contract\8217"," It is a member of the hidden package \8216playground-common-0.1.0.0\8217."," You can run \8216:set -package playground-common\8217 to expose it."," (Note: this unloads all the modules in the current scope.)"," Use -v (or `:set -v` in ghci) to see a list of the files searched for."," |","2 | import Playground.Contract"," | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"]},CompilationError {filename = "/private/tmp/web-ghc-work-f7221c0023582e5f/Main.hs", row = 3, column = 1, text = [" error:"," Could not load module \8216Plutus.Contract\8217"," It is a member of the hidden package \8216plutus-contract-0.1.0.0\8217."," You can run \8216:set -package plutus-contract\8217 to expose it."," (Note: this unloads all the modules in the current scope.)"," Use -v (or `:set -v` in ghci) to see a list of the files searched for."," |","3 | import Plutus.Contract"," | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"]},CompilationError {filename = "/private/tmp/web-ghc-work-f7221c0023582e5f/Main.hs", row = 4, column = 1, text = [" error:"," Could not load module \8216PlutusTx.Prelude\8217"," It is a member of the hidden package \8216plutus-tx-0.1.0.0\8217."," You can run \8216:set -package plutus-tx\8217 to expose it."," (Note: this unloads all the modules in the current scope.)"," It is a member of the hidden package \8216plutus-tx-0.1.0.0\8217."," You can run \8216:set -package plutus-tx\8217 to expose it."," (Note: this unloads all the modules in the current scope.)"," Use -v (or `:set -v` in ghci) to see a list of the files searched for."," |","4 | import PlutusTx.Prelude"," | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"]}]))
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! plutus-playground-client#1.0.0 start: `npm install && plutus-playground-generate-purs && npm run purs:compile && npm run webpack:server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the plutus-playground-client#1.0.0 start 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/danicuki/.npm/_logs/2021-07-06T16_34_12_339Z-debug.log
How can I solve
i am trying to run expressjs project it's shows errors like
AssertionError [ERR_ASSERTION]: Host should not be empty at proxy (/../../Desktop/folder/myproject/node_modules/express-http-proxy/index.js:27:3)
{
generatedMessage: false,
code: 'ERR_ASSERTION',
actual: undefined,
expected: true,
operator: '=='
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! authentication#1.0.0 start: ./node_modules/typescript/bin/tsc; node main
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the authentication#1.0.0 start 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! /home/folder/.npm/_logs/2020-01-01T07_03_08_044Z-debug.log
Your app is using proxy from express-http-proxy, proxy is supposed to take first argument as a value. That value is missing or undefined.
Check all the occurrence of proxy function inside your app and find the missing argument, most probably you have defined that value and taken from .env file but it's not define inside .env file.