"Can't load package" and "Use of internal package not allowed" when running goapp test - google-app-engine

When I run the command:
goapp test ./...
I get the errors:
can't load package: package github.com/projectname/oauth2: code in directory /Users/nyname/go/src/github.com/projectname/oauth2 expects import "github.com/projectname/oauth2"
can't load package: package github.com/projectname/oauth2/clientcredentials: code in directory /Users/nyname/go/src/github.com/projectname/oauth2/clientcredentials expects import "github.com/projectname/oauth2/clientcredentials"
can't load package: package github.com/projectname/oauth2/google: code in directory /Users/nyname/go/src/github.com/projectname/oauth2/google expects import "github.com/projectname/oauth2/google"
can't load package: package github.com/projectname/oauth2/jws: code in directory /Users/nyname/go/src/github.com/projectname/oauth2/jws expects import "github.com/projectname/oauth2/jws"
package github.com/projectname/oauth2/jwt
imports github.com/projectname/oauth2/internal: use of internal package not allowed
It seems like no one else on my team get's this error.

Related

Not able to import package in Next js

I installed the Jodit Editor using npm -i jodit-react. The package is added in the node modules but I am unable to import it.
This is is how I am importing the package import JoditEditor from "../../node_modules/jodit-react/index";
And this is the error I am getting: Module not found: Can't resolve '../../node_modules/jodit-react/index'
Screenshot of the error:
Change this line:
import JoditEditor from "../../node_modules/jodit-react/index";
To:
import JoditEditor from 'jodit-react';
You can take a look at this live working example with Next.js

Failed to resolve entry for package "material-symbols"

After installing material-symbols using npm the following message is shown in the console
My steps
Run in the console npm i material-symbols#latest
Add import 'material-symbols'; at the top of the __layout.svelte file
Add <span class="material-symbols-outlined">face</span> to the component file
Open console
Error message is shown
Error message
Failed to resolve entry for package "material-symbols". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "material-symbols". The package may have incorrect main/module/exports specified in its package.json.
As was able to run this package by changing the approach. I replaced step 2 with CSS imports.
Instead of
// __layout.svelte
import 'material-symbols';
...
I created 'app.css' file in the src folder. Added #import 'material-symbols'; at the top of its file. Imported app.css into __layout.svelte.
/* app.css */
#import 'material-symbols';
// __layout.svelte
- import 'material-symbols';
+ import '../app.css';
...
It works

Trouble getting react-suite to work within Gatsby project

I'm just starting out developing with Gatsby (or doing frontend in general) and I wanted to add a Navigation bar to my website using React Suite. However, when importing the corresponding stylesheet in my index.js:
import 'rsuite/lib/styles/index.less';
I get the following message when running gatsby develop:
ERROR #98124 WEBPACK
Generating development JavaScript bundle failed
Can't resolve 'rsuite/lib/styles/index.less' in '/Users/.../src/pages'
If you're trying to use a package make sure that 'rsuite/lib/styles/index.less' is installed. If you're trying to use a local file make sure that the path is correct.
File: src/pages/index.js:14:0
failed Building development bundle - 7.237s
ERROR in ./src/pages/index.js 14:0-38
Module not found: Error: Can't resolve 'rsuite/lib/styles/index.less' in '/Users/.../src/pages'
# ./.cache/_this_is_virtual_fs_path_/$virtual/async-requires.js 31:11-33:5
# ./.cache/app.js 17:0-52 28:0-70 30:27-40 28:0-70
webpack compiled with 1 error
I tried so many things already: installing and reinstalling rsuite, installing and reinstalling gatsby-plugin-less and less, clearing the cache, trying all kinds of configurations in gatsby-config.js, but I'm out of options really.
Meanwhile, installing react-bootstrap and importing the stylesheet similarly through
import "bootstrap/dist/css/bootstrap.min.css";
does not produce the error and the stylesheet gets applied.
Would greatly appreciate your help!
I think you should be using:
import '~rsuite/lib/styles/index.less';
Notice the ~, as it is inferred from the docs.
You can try this:
import "rsuite/src/styles/themes/default/index.less"
https://github.com/rsuite/rsuite/blob/next/examples/with-gatsby/src/pages/index.js#L4

How to use Sigma.js in React with Typescript

I'm trying to set up a simple web app with React/TypeScript so I can fiddle with some graphs with Sigma.js. But I can't get the end result to render anything with Sigma.
Here's the steps I followed:
$ npx create-react-app sigmafiddle --template typescript^C
$ cd sigmafiddle
$ yarn add sigma
$ yarn add #types/sigmajs
However, when I go to import Sigma I encounter the following problems:
import { sigma } from 'sigma'
Fails with this error message:
TypeScript error in ~/devel/sigmafiddle/src/App.tsx(4,23):
Could not find a declaration file for module 'sigma'. '~/devel/sigmafiddle/node_modules/sigma/endpoint.js' implicitly has an 'any' type.
Try npm install #types/sigma if it exists or add a new declaration (.d.ts) file containing declare module 'sigma'; TS7016
Not a real helpful message, since #types/sigma does not exist within npm.
And if I try this:
import { sigma } from 'sigmajs'
I get this failure:
TypeScript error in ~/devel/sigmafiddle/src/App.tsx(4,23):
File '~/devel/sigmafiddle/node_modules/#types/sigmajs/index.d.ts' is not a module. TS2306
I've also tried the package react-sigma:
yarn add react-sigma
// in app.tsx
import {Sigma, RandomizeNodePositions, RelativeSize} from 'react-sigma';
Unfortunately there is no #types/react-sigma package, so this results in the following error:
Cannot find module 'react-sigma'
How can I get sigma.js to work with TypeScript and React?
You didn't import what you are trying to use
replace
/// <reference types="#types/sigmajs" />
to
import { sigma } from 'sigma';
Usually, import as above is the common way to use lib in js/ts project.
Update
Since the error seems to be lacking type definition of the lib,
File '~/devel/graph-grammar/node_modules/#types/sigmajs/index.d.ts' is not a module.
npm install --save #types/sigmajs
And import as normal may work.
import { sigma } from 'sigma';
Refer to #types/sigmajs
Update No.2
You may need react-sigma npm, repo in your react project instead.
Install it, and import refer to the document seems fine.
import {Sigma, RandomizeNodePositions, RelativeSize} from 'react-sigma';
If that not work, try to install both sigma and react-sigma, since ploty.js need both ploty.js and react-ploty.js been installed, I guess you may meet the similar situation.
Update No.3
Seems react-sigma don't support typescript, they support flow-type instead.
Refer: document of react-sigma

deploying gatsby (v2) to netlify errors

I'm having some issues deploying to netlify. These are the errors I receive:
Error: ./src/pages/index.js
12:55:30 PM: Module not found: Error: Can't resolve '../components/Featured' in '/opt/build /repo/src/pages'
12:55:30 PM: resolve '../components/Featured' in '/opt/build/repo/src/pages'
12:55:30 PM: using description file: /opt/build/repo/package.json (relative path: ./src/p ages)
12:55:30 PM: Field 'browser' doesn't contain a valid alias configuration
For some reason it can't find the components. Building locally works fine.
I used gatsby-starter w styled-components.
things I tried:
I had some local building errors regarding the window undefined. I fixed these by conditionally including them as the manual proposes.
After applying this, I started receiving console logs from ‘workbox’.
(btw this is my first time trying to deploy to netlify)
also the error Field 'browser' doesn't contain a valid alias configuration keeps repeating in the logs
here's a link to the full log I get from netlify
The errors are due to webpack not being able to resolve your relative paths. Make sure to use the correct case.
import Hero from '../components/hero'
import Introduce from '../components/introduce'
import HelpMeHelpYou from '../components/helpmehelpyou'
import Featured from '../components/featured'
import Testimonials from '../components/testimonials'
import Projects from '../components/projects'
import Gallery from '../components/gallery'
import Outroduce from '../components/outroduce'
Run below command and then push the code to Github repository.
git config core.ignorecase false

Resources