Questions tagged [npm-package]
464 questions
620
votes
32 answers
SyntaxError: Cannot use import statement outside a module
I've got an ApolloServer project that's giving me trouble, so I thought I might update it and ran into issues when using the latest Babel. My "index.js" is:
require('dotenv').config()
import {startServer} from './server'
startServer()
And when I…

user3810626
- 6,798
- 3
- 14
- 19
14
votes
1 answer
Difference between Material-Ui and Material-Ui-Next
I am trying to add Material-Ui React components in my project and I'm confused with these 2 websites / libraries.
Material-Ui-Next -> https://material-ui-next.com/
Material-Ui -> http://www.material-ui.com
Both websites have a link to Github -…

TTCG
- 8,805
- 31
- 93
- 141
11
votes
6 answers
SyntaxError: Cannot use import statement outside a module (from dependency)
How do you resolve "Cannot use import statement outside a module" from a dependency when the dependency isn't declared as a module?
I want to use the validator in Svelte/kit to validate emails. However, when importing the ESM version, I get the…

Nick
- 5,108
- 2
- 25
- 58
11
votes
1 answer
"Lerna List" and "Lerna Changed" Returns 0 Packages
Gist
I have a monorepo and I am using yarn workspaces and lerna to manage it. I had no issues with it until now. I need to know all the changed packages since the last release.
Issue
So I run lerna changed (docs), but this is what it returns:
info…

Florian Ludewig
- 4,338
- 11
- 71
- 137
10
votes
6 answers
npm package seems to be corrupted
I am getting these warnings and then errors at the end. What is the fix?
npm WARN deprecated core-js@2.6.10: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the…

Muzaffar Mahmood
- 1,688
- 2
- 17
- 20
10
votes
1 answer
How do I use webpack dynamic imports inside an NPM package?
I have a navbar npm package that I import into other projects. It dynamically imports FontAwesome icons based on a JSON config file loaded from a web server at runtime.
When I build the navbar package, the entire FontAwesome library ends up as…

John
- 565
- 1
- 5
- 14
9
votes
5 answers
ReferenceError: TextEncoder is not defined Node.js with mongoose
the problem seems to be with mongoose & mongodb packages as it works fine when
mongoose.connect('mongodb+srv://mydb:@cluster0.w1opr.mongodb.net/test?retryWrites=true&w=majority');
is removed
it also works fine on repl.it cloud env
here is…

Seif Hafri
- 93
- 1
- 1
- 6
9
votes
1 answer
How to publish/deploy a npm package to custom artifactory
I want to do something like this:
Create an npm package. Basically, a common code which I want to use for all of my projects. Which I created.
But now What I want is, Every time I commit something in git for this project, Jenkins should build it…

Inder
- 133
- 1
- 1
- 5
7
votes
1 answer
How to resolve a peer dependency issue caused by AWS Amplify?
I am having a problem with my react build, maybe related to AWS amplify, but I’m having trouble pinning it down.
When it started, I was able to run my program locally without a problem. I uploaded it to GitHub and my CI/CD setup with amplify tried…

Breakwater
- 83
- 6
7
votes
2 answers
How to create Vue package that imports another component
We are attempting to create a Vue npm package where one component imports another component (a simple example might be - the package contains a generic button component, and a table component that uses my button component for paging). I can import…

KiwiDB
- 83
- 6
7
votes
0 answers
Try to install and configure jest in my react-native component to publish
Environment description:
I have to create a react-native component and publish it to npm. In my process I have to planned the executing of unit tests but after many tries I cannot configure jest for my projet.
See bellow my package.json.There is no…

Florian Garcia
- 71
- 4
6
votes
4 answers
The legacy expo-cli does not support Node +17
I have installed expo-cli and set the env variable. It gives this error:
The legacy expo-cli does not support Node +17. Migrate to the versioned Expo CLI (npx expo).
Uncaught Error Error: EPERM: operation not permitted, mkdir 'C:\Users\a.expo'
Node…

Anosha Sheikh
- 61
- 1
- 1
- 4
6
votes
2 answers
npm install from tfs feed (on build process) give error: Unable to authenticate
We have our own npm package and a project that uses it,
I want to publish it to a tfs feed - repository and install it from there instead of from a physical file.
I published the package to the feed from my development machine,
and I changed the…

banana
- 1,186
- 4
- 14
- 26
5
votes
0 answers
Error: Unexpected `storiesOf` usage: C:/Users/imran/react-package/src/stories/Requirements.stories.js (line 6, col 16)
Unable to index ./src/stories/Requirements.stories.js:
Error: Unexpected storiesOf usage: C:/Users/imran/react-package/src/stories/Requirements.stories.js (line 6, col 16).
In SB7, we use the next-generation storyStoreV7 by default, which does not…

Tricky Tipsy
- 95
- 6
5
votes
3 answers
Build failed because of webpack errors
I am getting below error from next js app suddenly. Any solution to fix that problem?
./pages/_app.tsx
Error: [BABEL] C:\Projects\skribeNew\app-web\pages\_app.tsx: You gave us a visitor for the node type TSSatisfiesExpression but it's not a valid…

Md. Nizam Uddin Mahmud
- 191
- 1
- 10