How to Uninstall Nuxt modules and packages - vue.js

I'm on Nuxt 2.13 and I wanna remove some packages. previously I would just remove them from the package.json file and would use npm i and the package would be removed but now I get this error:
Module #nuxtjs/google-gtag not found. Please ensure #nuxtjs/google-gtag is in dependencies and installed.
FATAL Cannot find module '#nuxtjs/google-gtag' 17:56:41
Require stack:
- C:\CODES\node_modules\#nuxt\core\dist\core.js
- C:\CODES\node_modules\#nuxt\cli\dist\cli-index.js
- C:\CODES\node_modules\#nuxt\cli\dist\cli.js
- C:\CODES\node_modules\nuxt\bin\nuxt.js
Error: Cannot find module '#nuxtjs/google-gtag'
Require stack:
- node_modules\#nuxt\core\dist\core.js
- node_modules\#nuxt\cli\dist\cli-index.js
- node_modules\#nuxt\cli\dist\cli.js
- node_modules\nuxt\bin\nuxt.js
at Resolver.requireModule (node_modules\#nuxt\core\dist\core.js:603:31)
at ModuleContainer.addModule (node_modules\#nuxt\core\dist\core.js:174:38)
at node_modules\#nuxt\utils\dist\utils.js:1818:43
at async ModuleContainer.ready (node_modules\#nuxt\core\dist\core.js:49:5)
at async Nuxt._init (node_modules\#nuxt\core\dist\core.js:693:5)
╭───────────────────────────────────────────────────────────────────╮
│ │
│ ✖ Nuxt Fatal Error │
│ │
│ Error: Cannot find module '#nuxtjs/google-gtag' │
│ Require stack: │
│ - C:\CODES\node_modules\#nuxt\core\dist\core.js │
│ - C:\CODES\node_modules\#nuxt\cli\dist\cli-index.js │
│ - C:\CODES\node_modules\#nuxt\cli\dist\cli.js │
│ - C:\CODES\node_modules\nuxt\bin\nuxt.js │
│ │
╰───────────────────────────────────────────────────────────────────╯
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nuxt#1.0.0 build: `nuxt build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nuxt#1.0.0 build 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! C:\Users\user\AppData\Roaming\npm-cache\_logs\2021-02-15T14_26_41_931Z-debug.log
I tried npm uninstall -S -D #nuxtjs/google-gtag and it worked but then when I uninstalled express i got this error again!
how can I safely remove packages from my nuxt app??

your approach is correct, but make sure that the module is not used anywhere.
in the case of Nuxt, besides the package.json, also check the nuxt.config.js (modules && buildModules) and also the plugins folder
docs:
https://nuxtjs.org/docs/2.x/directory-structure/nuxt-config/#modules
https://nuxtjs.org/docs/2.x/directory-structure/modules/
https://nuxtjs.org/docs/2.x/directory-structure/plugins/

Related

Error when running 'npm install' and 'npm start'

I ran npm install in my project directory.
But I get this error while running npm install:
D:\Personal\██████████████████████████████████████████████████████████████\rn-starter-main>npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
npm ERR! Found: react#17.0.1
npm ERR! node_modules/react
npm ERR! react#"17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.0" from #react-native-community/masked-view#0.1.10
npm ERR! node_modules/#react-native-community/masked-view
npm ERR! #react-native-community/masked-view#"0.1.10" 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.
npm ERR!
npm ERR! See C:\Users\███████\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\███████\AppData\Local\npm-cache\_logs\2022-04-02T02_39_48_352Z-debug-0.log```
npm install --force installed the packages, but when I run npm start, I get the following error:
D:\Personal\████████████████████████████████████████████████████████\rn-starter-main>npm start
> start
> expo start
┌─────────────────────────────────────────────────────────────────────────┐
│ │
│ There is a new version of expo-cli available (5.3.0). │
│ You are currently using expo-cli 5.1.1 │
│ Install expo-cli globally using the package manager of your choice; │
│ for example: `npm install -g expo-cli` to get the latest version │
│ │
└─────────────────────────────────────────────────────────────────────────┘
Starting project at D:\Personal\███████████████████████████████████\rn-starter-main
Unable to find expo in this project - have you run yarn / npm install yet?
For the conflicting peer dependency error, I tried:
npm install --legacy-peer-deps and
npm install --force
But none of them seems to have worked. This error is still persisting.
For the expo not found error, I tried commands like:
npm cache clean,
expo install,
expo update,
npm add expo
expo rebuild etc.
I thought this error might be due to older expo versions like 36 and 37 that I've worked with, so, I uninstalled all of Node and NPM and downloaded them again from https://nodejs.org/en/ , but I still get the same "conflicting peer dependency" and "Unable to find expo" errors. Could you please help me with this? Thank you.
Running the command npm install -g expo-cli fixes both the errors. These errors are just due to npm not being installed globally.

npm cant change Jasmine package version

if I run npm view jasmine version or npm view jasmine version -g from ~ the version returned is 3.3.1
I need the version to be 2.8.0 so i try to downgrade with npm install jasmine#2.8.0 -g but npm view jasmine version is still 3.3.1
Now if i do npm list -g i see the correct version for jasmine (2.8.0)... So where is the 3.3.1 coming from?
├─┬ jasmine#2.8.0
│ ├── exit#0.1.2
│ ├─┬ glob#7.1.3
│ │ ├── fs.realpath#1.0.0
│ │ ├─┬ inflight#1.0.6
│ │ │ ├── once#1.4.0 deduped
│ │ │ └── wrappy#1.0.2
│ │ ├── inherits#2.0.3
│ │ ├─┬ minimatch#3.0.4
│ │ │ └─┬ brace-expansion#1.1.11
│ │ │ ├── balanced-match#1.0.0
│ │ │ └── concat-map#0.0.1
│ │ ├─┬ once#1.4.0
│ │ │ └── wrappy#1.0.2 deduped
│ │ └── path-is-absolute#1.0.1
│ └── jasmine-core#2.8.0
Understanding the npm view command:
When you run either of the following npm view commands:
npm view jasmine version
or
npm view jasmine version -g
you are sending a GET request to the npm registry. More specifically you are sending a request to the following endpoint:
https://registry.npmjs.org/jasmine
You can verify this by appending the -d option to your command for additional logging information. For instance, if you run;
npm view jasmine version -d
you'll see additional information in your log which includes something like the following:
npm http request GET https://registry.npmjs.org/jasmine
Note: This line above indicates the endpoint which your view command is making the request to.
So where is the 3.3.1 coming from?
3.3.1 is the latest version of the jasmine package available in the npm registry. The result of any view command does not indicate information about packages installed on your system, instead it returns information (metadata) about packages held in the npm registry.
You'll continue to see version 3.3.1 logged to your console when running;
npm view jasmine version
(from any directory location on your system), until a newer version of jasmine is published to the npm registry.
Additional Notes:
The two npm commands that you are running, namely:
npm view jasmine version
and
npm view jasmine version -g
are effectively the same command. The view command does not provide a -g option. The -g option is simply being ignored.
The npm list command, (as you've already discovered), should be utilized for retrieving information about packages that are installed on your system. Hence that why its indicating your expected result(s).

Downgrade Parse Server

I've been trying for 2 hours straight now, to downgrade Parse Server from 3.0.0 to 2.8.4 and I fail every time!
I changed it from package.json, npm install, go to dashboard, still: server version 3.0.0!
Here are the logs of the installation:
npm install
npm WARN deprecated uws#10.148.1: stop using this version
parse-server-example#1.4.0 /root/parse-server-example
├─┬ parse-dashboard#1.2.0
│ └─┬ express#4.16.3
│ ├── array-flatten#1.1.1
│ ├── encodeurl#1.0.2
│ ├─┬ finalhandler#1.1.1
│ │ └── encodeurl#1.0.2
│ ├─┬ send#0.16.2
│ │ └── encodeurl#1.0.2
│ └─┬ serve-static#1.13.2
│ └── encodeurl#1.0.2
└─┬ parse-server#2.8.4
├─┬ #parse/push-adapter#3.0.0-alpha2
│ └─┬ parse#1.11.1
│ └─┬ ws#3.3.3
│ └── ultron#1.1.1
├── #parse/simple-mailgun-adapter#1.0.2
├── commander#2.16.0
├─┬ express#4.16.2
│ ├── array-flatten#1.1.1
│ └── encodeurl#1.0.2
├── lru-cache#4.1.2
├─┬ mongodb#3.1.1
│ └─┬ mongodb-core#3.1.0
│ └── bson#1.0.9
├─┬ parse#1.11.1
│ └─┬ ws#3.3.3
│ └── ultron#1.1.1
└── request#2.85.0
npm ERR! Linux 4.15.0-34-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! path /root/parse-server-example/node_modules/.staging/node-pre-gyp-49f396d5
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/root/parse-server-example/node_modules/.staging/node-pre-gyp-49f396d5' -> '/root/parse-server-example/node_modules/bcrypt/node_modules/node-pre-gyp'
npm ERR! enoent ENOENT: no such file or directory, rename '/root/parse-server-example/node_modules/.staging/node-pre-gyp-49f396d5' -> '/root/parse-server-example/node_modules/bcrypt/node_modules/node-pre-gyp'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! /root/parse-server-example/npm-debug.log
What can I do?
Absolutely never run this command without looking at what's going to be deleting and understanding whether or not it's OK, but try doing rm -rf <path>/node_modules/*. Maybe wait for a comment or two confirming. Seriously don't just randomly do an rm -rf command because someone on the internet told you to.
But in this case, you should be fine deleting node_modules, and a package-lock.json if it exists, and running npm install to do a bit of a fresh install of what's in your package.json.
Seriously, absolutely don't do this until you look up what it is you're doing and verify it'd be OK.
package-lock.json tracks the changes in the versions of modules you use. node_modules is where npm install installs all the modules to. When you run the command, it checks your node_modules vs your package.json to see if there are any more recent versions that match your criteria. Idk why it's not downgrading, but if your package.json is set up right, this should give it a fresh install and should work.
Do at your own risk, though.

react-native start faild, npm start faild. project is not run

react-native run-android . server is faild, I don't know how to solve it. hope someone can help me。
react-native start faild .
npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/Cellar/node#5/5.12.0/bin/node"
"/usr/local/bin/npm" "start"
npm ERR! node v5.12.0
npm ERR! npm v3.8.6
npm ERR! code ELIFECYCLE
npm ERR! 1#1.1.1 start: `node node_modules/react-native/local-
cli/cli.js start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the 1#1.1.1 start script 'node node_modules/react-
native/local-cli/cli.js start'.
npm ERR! Make sure you have the latest version of node.js and npm
installed.
npm ERR! If you do, this is most likely a problem with the 1 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node node_modules/react-native/local-cli/cli.js start
npm ERR! You can get information on how to open an issue for this
project with:
npm ERR! npm bugs 1
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls 1
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/apple/Desktop/project/reactproject/IRunning/npm-debug.log
.
Last login: Fri Jan 13 09:45:42 on ttys000
AppledeMacBook-Pro:~ apple$
/Users/apple/Desktop/project/reactproject/IRunning/node_modules/
.0.36.0#react-native/packager/launchPackager.command ; exit;
~/Desktop/project/reactproject/IRunning/node_modules/.0.36.0#react-
native/packager ~
Scanning 1631 folders for symlinks in /Users/apple/Desktop/project/reactproject/IRunning/node_modules (30ms)
┌──────────────────────────────────────────────────────────────────────── ────┐
│ Running packager on port 8081.
│
│
│
│ Keep this packager running while developing on any JS projects. Feel │
│ free to close this tab and run your own packager instance if you
│
│ prefer.
│
│
│
│ https://github.com/facebook/react-native
│
│
│
└────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
Cannot read property 'on' of undefined
~
Process terminated. Press <enter> to close the window
Looks like you have to reinstall or update node.js and npm. Try to follow instalation steps on this page once more:
https://facebook.github.io/react-native/docs/getting-started.html#content
Also make sure you are following instructions for correct system you are using

Cannot install jasmine-core on Windows 7 / OSX

I am trying to install karma-jasmine on Windows 7 / Git Bash, according to these guidelines: http://karma-runner.github.io/0.13/intro/installation.html
However, the installation fails for jasmine-core:
$ npm install karma-jasmine karma-chrome-launcher --save-dev
npm WARN install Couldn't install optional dependency: Unsupported
ngut#1.0.0 g:\SW Engineering\ngUT
├── UNMET PEER DEPENDENCY jasmine-core#*
├─┬ karma-chrome-launcher#0.2.2
│ ├─┬ fs-access#1.0.0
│ │ └── null-check#1.0.0
│ └─┬ which#1.2.0
│ └─┬ is-absolute#0.1.7
│ └── is-relative#0.1.3
└── karma-jasmine#0.3.6
npm WARN EPEERINVALID karma-jasmine#0.3.6 requires a peer of jasmine-core#* but
none was installed.
I tried the installation first with Cygwin, only to learn that npm is not supported on Cygwin, but there the failing dependency was fsevent.
The global installation of jasmine-core succeeds, but I am trying to follow this tutorial and karma start karma.conf.js fails for the same reason (missing jasmine-core) with the global installation as well.
Finally, the exact same problem appears on OSX as well.
Karma v.0.13.16 just did not support v.5.3.0 of Node. The supported Node versions were listed on Karma installation page.