I installed uuid with npm i uuid
and tried to import using import { v4 as uuidv4 } from 'uuid'; as per the instructions. I checked the node_modules folder and uuid is there. But I'm getting an error Could not find a declaration file for module 'uuid'. and uuid/dist/index.js' implicitly has an 'any' type. any idea? thx
Install #types/uuid as dev dependency. somehow that fixes the issue idk.
npm i --save-dev #types/uuid
Related
I have created a custom npm package library, I have successfully created it and published on npm and then installed the package using npm install <my-package-name>.
And now I am facing issue on importing the package.When I import it in app.module.ts file its shows:
Cannot find module 'my-module-name' or its corresponding type declarations.
I have also tried by deleting the node-modules and package-lock.json files and then npm install but sadly it's not works.
I published my first package using npm. However, when I import it in Codesandbox it gives me a warning
Error when converting '/node_modules/protected-react-routes-generators/src/index.js' esmodule to commonjs: Cannot read property 'type' of null
This is my github Repo
Also when i installed it from NPM, it gives me this error
I don't know what this error is, any clue ?
Thanks!
Babel can't compile jsx extensions. Install:
npm install --save-dev #babel/preset-react
And add to your .babelrc file:
{"presets": ["#babel/preset-react"]}
I made a mistake which I published the package as a react component without build it to be a raw javascript
I am trying to use Chart.js library in my project.
I want to import it externaly and not to instal the package by npm install.
Also about #types/chart.js I must install it from npm install or there is other option externally.
Thanks!
Have VueJS app with firebase for login, firestore, hosting, functions. Wanted to also add the new performance monitoring, which requires to update to Firebase 6.0.2
Did importings as suggested in docs.
main.ts
// Firebase App is always required and must be first
import * as firebase from "firebase/app";
import 'firebase/auth';
import 'firebase/firestore';
import 'firebase/performance';
import { config } from "#/helpers/firebaseConfig";
firebase.initializeApp(config);
const perf = firebase.performance()
To config added the new appID.
But it started throwing error
firebase_app__webpack_imported_module_11__.auth is not a function
also got '.peformance' is not a function
Looks like webpack import is not right, but don't understand whats wrong, because reverted back to 5.11.1 and worked like before.
Any tips?
Looks like this 'brutal' approach solved the problem. Maybe it will save others half day of frustration.
npm uninstall --save firebase firebase-admin
rm -rf node_modules
rm package-lock.json
rm -rf ~/.npm
npm install
npm install firebase --save
npm install firebase-admin --save
I downloaded a package from github: list.fuzzysearch.js. Unzipped it to a folder
Then in my project folder, I install it as follows:
npm install Path/to/LocalFolder/list.fuzzysearch.js-master -S
When I bundle my project js using webpack, I got below error, which seems to miss some module required by the package I installed.
Question 1: Should I do a npm install in the downloaded package's folder first, before I install this package into my project. i.e: ~/local/folder/list.fuzzysearch.js-master$ npm install
Question 2: when I import a module in my app.js, how do I write the path? i.e. import module frommodulePath, thatmodulePath`, shall I just put module name (e.g. 'react'), or the path to the js file in node_module folder (e.g. 'node_module/react/dist/react.js') ?
Question 3: is there a way to find out all transitive dependency of a module, and install them along the way?
errors:
ERROR in ./~/list.fuzzysearch.js/index.js
Module not found: Error: Cannot resolve module 'classes' in /home/mypc/IdeaProject/OpenDimSum/frontend/node_modules/list.fuzzysearch.js
# ./~/list.fuzzysearch.js/index.js 1:14-32
ERROR in ./~/list.fuzzysearch.js/index.js
Module not found: Error: Cannot resolve module 'extend' in /home/mypc/IdeaProject/OpenDimSum/frontend/node_modules/list.fuzzysearch.js
# ./~/list.fuzzysearch.js/index.js 3:13-30
ERROR in ./~/list.fuzzysearch.js/index.js
Module not found: Error: Cannot resolve module 'to-string' in /home/mypc/IdeaProject/OpenDimSum/frontend/node_modules/list.fuzzysearch.js
# ./~/list.fuzzysearch.js/index.js 4:15-35
ERROR in ./~/list.fuzzysearch.js/index.js
Module not found: Error: Cannot resolve module 'get-by-class' in /home/mypc/IdeaProject/OpenDimSum/frontend/node_modules/list.fuzzysearch.js
# ./~/list.fuzzysearch.js/index.js 5:17-40
my app javascript:
require('../../../node_modules/bootstrap/dist/css/bootstrap.css')
require ('../public/styles.css')
require ('../index.html')
import React from 'react'
import {render} from 'react-dom'
import 'list.js'
import 'list.fuzzysearch.js'
require('../../../node_modules/bootstrap/dist/js/bootstrap')
Looks like the script you want to use is an npm package, even though it isn't published to the npm registry. This is how you can add it to your project:
Add "list.fuzzysearch": "javve/list.fuzzysearch.js" under dependencies in your package.json
npm install as usual
import fuzzysearch from 'list.fuzzysearch'
???
PROFIT!!!
The npm client is really flexible when it comes to where a package can be installed from. Here's the relevant documentation.