Error While using sp-dialog with react project - spfx

I have a running tsx file that loads a ListView. The project loads fine. I ran the following command
npm install # microsoft/sp-dialog
Then in the tsx in added the following import statement.
import { SPHttpClient } from '# microsoft/sp-http';
When I use gulp build, I am getting the following error.
_Error - typescript - node_modules\#microsoft\sp-dialog\node_modules\#microsoft\sp-core-library\lib\deferredCl
ass\DeferredClass.d.ts(25,24): error TS1005: ';' expected._
I can see the error is pointing to the abstract keyword in the DeferredClass.ts file. How can I fix this?

You may have just mistyped the commands and code into SO but if not....
You need to remove the space between the # and microsoft

Related

gopls returns the error "gopls: no packages returned: packages.Load error" for github.com/Shopify/sarama

I've checked out the main branch of github.com/Shopify/sarama (at commit 947343309601b4eb3c2fa3e7d15d701b503dd491 ) but I notice that in VS Code I can't "Go to definition" as usual. If I hover over the package name sarama in functional_consumer_group_test.go, I get the linter warning
No packages found for open file /Users/kurtpeek/go/src/github.com/Shopify/sarama/functional_consumer_group_test.go: <nil>.
If this file contains build tags, try adding "-tags=<build tag>" to your gopls "buildFlags" configuration (see (https://github.com/golang/tools/blob/master/gopls/doc/settings.md#buildflags-string).
Otherwise, see the troubleshooting guidelines for help investigating (https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md).go list
(See screenshot below).
From the command line, if I try to gopls that file, I get a similar error:
> gopls check functional_consumer_group_test.go
gopls: no packages returned: packages.Load error
I suspect this has something to do with the build constraints (https://pkg.go.dev/cmd/go#hdr-Build_constraints) in that file, from https://github.com/Shopify/sarama/blob/947343309601b4eb3c2fa3e7d15d701b503dd491/functional_consumer_group_test.go#L1-L2,
//go:build functional
// +build functional
It's not clear to me, however, how to modify my VS Code settings.json to pass these build constraints. Does anyone know how to get this functional test to build?
Following https://www.ryanchapin.com/configuring-vscode-to-use-build-tags-in-golang-to-separate-integration-and-unit-test-code/, I had to create a .vscode/settings.json file in the repository's root directory and add the following contents:
{
"go.buildFlags": [
"-tags=functional"
],
"go.testTags": "functional",
}
Now VS Code works like normal in that file:
Have you tried go clean -cache?
And this link may help:
https://github.com/golang/go/issues/42353
This worked for me!
by adding it in .vscode/settings.json
{
"gopls.env": {
"GOFLAGS": "-tags=test"
}
}

Receiving a "module not found" and "field 'browser' doesn't contain a valid alias configuration" deploying my site to Netlify

My GatsbyJS site runs fine locally but does not produce a successful build when deploying to Netlify. I've researched the error I'm receiving and haven't had any luck. Changing the case of the file name or changing the file path doesn't work.
Link to repository
On your local machine, run the command gatsby build will result in the error you show in the images.
You will notice the error lines:
Error: ./src/components/header.js
... Can't resolve 'components/variables.css' in ...
opt/build/repo/node_modules/components/variables.css doesn't exist
tells you it is trying to resolve the components/variables.css as a module in your project.
Solution
Change the import line for variables.css in header.js:
src/components/header.js
import styled from 'styled-components'
import 'components/variables.css'
...
to the following:
src/components/header.js
import styled from 'styled-components'
import './variables.css'
...
Make sure netlify knows what version of node you need to build your app.
https://www.netlify.com/docs/build-settings/#build-environment-variables
Also make sure your project is able to build from scratch. Clone the repository into a new directory and try to build it.

E0611 error on import when I know the file exists

With pylint, I'm getting an E0611 error on an import when I know the file exists and the script runs fine. Suggestions? I annotated the image below with the error.
Try this:
In VS Code Preferences > Settings, change the "python.linting.pylintPath" to the virtual env path "/bin/pylint"
https://github.com/Microsoft/vscode-docs/blob/master/docs/python/linting.md
Removing all ignored files (in the __pycache__-folder, etc.) using the command git clean -dfx fixed the issue for me. (Warning: Ensure you do not have any important git-ignored files which you want to keep before executing this command.)

Sass - File to import not found or unreadable - yeoman webapp generator

I have annoying issue with sass plugin. I use yeoman webapp geneator with default configuration. When I want to build production files (gulp command) I get sass error "File to import not found or unreadable [...]". It works only at first running gulp command – dist folder build properly. But when I want to run gulp command again I keep receiving this error (I have to restart computer to make it works again – at first run :) ). On the other hand, running "gulp serve" (live preview) command gets this same error only at fresh start – when I modify some .scss, files compile properly.
This is the main SCSS file:
// bower:scss
#import "bower_components/slick-carousel/slick/slick.scss";
// endbower
#import '_reset', '_fontello', '_variables', '_helpers', '_basic',
'_widerScreens', '_carousel';
Yeoman webapp generator v.3.0.1
I found this solution. Try to reproduce.
https://garystanton.co.uk/gulp-sass-file-to-import-not-found-or-unreadable/

Why does command "tsc file.ts" give no output and not produce a js file?

I have just started work on a project with some typescript code, and I'm trying to compile the .ts files to .js files from within Linux Mint, but it's not working as I'd expect.
There is a Makefile, but it's not working. Running make returns an error:
tsc --noImplicitAny --noEmitOnError --out client/welcome.js client/welcome.ts
make: *** [client/welcome.js] Error 1
I have also tried creating an example typescript file greeter.ts (as per this official tutorial) containing:
function greeter(person) {
return "Hello, " + person;
}
var user = "Jane User";
document.body.innerHTML = greeter(user);
and tried compiling the ts file to javascript with the command (as per the same tutorial) tsc greeter.ts however the command completes with no output, and no .js file has been created.
I haven't previously worked with typescript at all, and though I've used Makefile's before I don't know much about them either, so I'm hoping it's something really obvious!
I encountered this problem because I had the following line in my tsconfig.json:
"noEmit": true
It worked after removing it.
--noEmitOnError
This means that if there is an error detected no js will be generated. I highly recommend not using this option (Changes a major benefit of why typescript)
More
Check your tsc version. The code you provided works fine with 1.6:
Update
The --version command should work at the very least. See below:

Resources