How to fix "Error: Watching remote files is not supported" problem in Visual Studio Code - vue.js

I have Vue application that I don't run for a while and now I cannot start development server?! In meanwhile something updated and that don't work. I tried new clean vue/vuetify install and same problem!
Build for production works normally, only run development server don't work.
And important notice: when run "npm run serve" in command prompt (outside VS Code), it works normally. That not work only in VS Code Terminal. What is problem?
Node version is v10.16.0
Npm version is 6.10.3
VS Code About:
Commit: 036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8
Date: 2019-08-08T02:33:50.993Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.17763
Error (from terminal window):
> Executing task: npm run serve <
> portal#0.1.0 serve d:\Wamp64\www\portal
> vue-cli-service serve
INFO Starting development server...
10% building 2/2 modules 0 active ERROR Error: Watching remote files is not supported.
Error: Watching remote files is not supported.
at Server.setupWatchStaticFeature (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:405:13)
at Object.watchContentBase (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:477:14)
at forEach (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:550:24)
at Array.forEach (<anonymous>)
at Server.setupFeatures (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:549:49)
at new Server (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:125:10)
at serve (d:\Wamp64\www\portal\node_modules\#vue\cli-service\lib\commands\serve.js:139:20)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portal#0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portal#0.1.0 serve 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\Sasa Gosovic\AppData\Roaming\npm-cache\_logs\2019-08-11T10_35_40_418Z-debug.log
The terminal process terminated with exit code: 1
Press any key to close the terminal.

Exactly the same issue here. I resolved it by rolling back the version of webpack-dev-server.
npm install webpack-dev-server#3.7.2 --save-dev
Looks like the setupWatchStaticFeature function has changed between 3.7.2 and 3.8.0 which is triggering the issue.

You can eddit the vue.config.js file, adding following code:
devServer: {
contentBase: './public'
}
More details: https://github.com/webpack/webpack-dev-server/issues/2190#issuecomment-520670599

Until the issue is open, a workaround could be to use Git Bash instead of Windows command line to run npm run serve. I modified Server.js to output the contentBase variable. When using Windows command line or Vue UI, the variable contained "c:\...". Using Git Bash on my Windows 10 machine it contains "C:\..." and it worked.

Related

What is the correct way of installing firebase-tools (a npm package) in NixOS/Nix?

I am watching this Udemy course on Firebase. The course is a bit dated, initially made maybe 6 years ago.
At some point the author indicates how to use firebase CLI, hence he indicates the command:
~/projects/chatlive]$ npm install -g firebase-tools
I added sudo to avoid permission problems:
~/projects/chatlive]$ sudo npm install -g firebase-tools
Unfortunately, this error message is retrieved:
npm WARN checkPermissions Missing write access to /nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules
npm ERR! code EROFS
npm ERR! syscall access
npm ERR! path /nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules
npm ERR! errno -30
npm ERR! rofs EROFS: read-only file system, access '/nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules'
npm ERR! rofs Often virtualized file systems, or other file systems
npm ERR! rofs that don't support symlinks, give this error.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-07-28T15_33_55_544Z-debug.log
I am using NixOS and this is my config file. Since the error message mentions the nix/store I thought it could be related.
Usually, I install things in NixOS changing my configuration.nix and doing sudo nixos-rebuild switch. But I thought it would not be necessary to do it considering npm was managing the installation.
Searching on Nix packages, I can see firebase-tools: link. Now, it seems that tweaking the config file is the way...
In situations like this, what is the best practice?
Should I force trying to install via npm (how?)? Should I go for a new generation of NixOS and a full system rebuild just because of this package?
Is there another possible path? Am I missing something?
Thanks.
If you just want to play around with firebase-tools in a development environment, create a shell.nix file in your working directory and add the following lines:
{ pkgs ? import <nixpkgs> {}}:
pkgs.mkShell {
nativeBuildInputs = [ pkgs.nodePackages.firebase-tools ];
}
Then run nix-shell to start a shell with firebase-tools included. This is considered best practice for local development environments, see https://nixos.wiki/wiki/Development_environment_with_nix-shell .
If you want to try out packages not in nixpkgs repo you should use npm and install a package locally (without -g ). See https://nixos.wiki/wiki/Node.js#Using_npm_install_-g_fails.

How to fix this json error while creating a new angular 8 project

i am facing this error, on visual studio code, immediately after having created a new angular 8 project:
PS C:\Users\HP\Desktop\stproject\my-app> npm install
npm ERR! Unexpected end of JSON input while parsing near '...eprecated"},"1.0.4":{'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HP\AppData\Roaming\npm-cache\_logs\2019-09-27T08_30_00_012Z-debug.log
The output is the above stated error, but this is wrong. The project should rather have been ready to be served using ng serve command.
kindly help....

How to ignore npm run errors and keep going on Travis-CI?

I have stage in Travis config that launch npm run build where the build is a script converting ts -> js. Locally, it returns two errors that doesn't matter anything, I can run a server anyway. But, these errors stop Travis moving on and fails.
- stage: "Build front"
before_script:
- cd front
- npm install
- npm run build
The error:
...
[0] npm run build:client exited with code 0
build/setupProdServer.ts(6,20): error TS2307: Cannot find module '../src/vue-ssr-server-bundle.json'.
build/setupProdServer.ts(7,28): error TS2307: Cannot find module '../src/vue-ssr-client-manifest.json'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
...
I tried add
allow-failures:
- node
- npm
and it not helped.
I need Travis ignore these errors and move to the next stage.
What kind of commands or parameters in Travis will solve it?
Just add || true:
- npm run build || true

Unhandled rejection error: invalid config key requested when attempting to update Cypress via NPM

I am trying to update Cypress to the latest version using the following provided command:
npm install --save-dev cypress#3.2.0
In previous versions this has worked fine with no errors. Now, when I run this, I keep getting the following error:
Unhandled rejection Error: invalid config key requested: agentn 099cbf610e4ce787
at BadKeyError (/usr/local/lib/node_modules/npm/node_modules/figgy-pudding/index.js:93:23)
at pudGet (/usr/local/lib/node_modules/npm/node_modules/figgy-pudding/index.js:101:5)
at FiggyPudding.get (/usr/local/lib/node_modules/npm/node_modules/figgy-pudding/index.js:27:12)
at Object.get (/usr/local/lib/node_modules/npm/node_modules/figgy-pudding/index.js:159:16)
at new PacoteOptions (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/util/opt-check.js:9:21)
at optCheck (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/util/opt-check.js:63:10)
at Object.manifest (/usr/local/lib/node_modules/npm/node_modules/pacote/manifest.js:11:10)
at fetchPackageMetadata (/usr/local/lib/node_modules/npm/lib/fetch-package-metadata.js:58:10)
at limited (/usr/local/lib/node_modules/npm/node_modules/call-limit/call-limit.js:29:10)
at /usr/local/lib/node_modules/npm/lib/install/deps.js:235:14
at /usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:35
at Array.forEach (<anonymous>)
at /usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:11
at Array.forEach (<anonymous>)
at asyncMap (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:51:8)
at exports.getAllMetadata (/usr/local/lib/node_modules/npm/lib/install/deps.js:206:3)
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jaswindersingh/.npm/_logs/2019-03-15T13_32_13_190Z-debug.log
Could anyone point me to what this means and how I can fix it?
Never seen this kind of error before?
And as far as I know I've not made any changes to any of my packages in either package.json or package-lock.json etc (from what I have read so far from similar posts)
I think this is an npm issue.
Try to delete package-lock.json and run your command again. This should solve your problem.
Also, if you can, try to upgrade your npm version, since this issue is marked as closed in npm repository.
It is really npm issue. Try to change version to some up-to-date one. If there is some problems with it, you can use nvm.
In my case I`ve changed node version 10.8.0 to 12.18.3 and npm as well.

npm install error - cb() never called

I try to install node_module in my angular project what I downloaded, but I get this error:
npm ERR! registry error parsing json
Then i reinstall npm using npm intall npm -g and after when i try use npm install I get this error:
(node:11252) UnhandledPromiseRejectionWarning: Unhandled promise
rejection (rejection id: 1): Error: ENOENT: no such file or directory, stat
'C:\Users\User\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-ec5da46c\angular\cdk.es5.js'
debug.log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install' ]
2 info using npm#5.4.2
3 info using node#v6.10.2
4 verbose npm-session ff5ce249dfe37f0e
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall spa#0.0.0
7 info lifecycle spa#0.0.0~preinstall: spa#0.0.0
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 silly install loadShrinkwrap
13 info lifecycle #angular/cdk#2.0.0-beta.10-a7ce31e~prepack: #angular/cdk#2.0.0-beta.10-a7ce31e
14 error cb() never called!
15 error This is an error with npm itself. Please report this error at:
16 error <https://github.com/npm/npm/issues>
I already tried npm cache clean --force but i get same error.
node -v v6.10.2
npm -v 5.4.2
I had the same issue. I resolved it
by excluding package-lock.json file
npm i --no-package-lock
OR by manually deleting package-lock.json
Run npm cache clean --force and perform an install.
I had the same issue. I resolved it by remove nodejs#10 and install nodejs#8
On Windows 10 running npm install gave me this error.
I solved this issue by doing so from within Administrator: Command Prompt.
Ensure that you have a package.json file within the root of your angular project which should look something similar to this.
https://github.com/heroku/node-js-sample/blob/master/package.json
If the package.json file exists, you run npm install to get the packages saved to it and that will generate a node_modules directory for you.
However, if the file does not exist, it means you have to initialize npm into the project by running npm i -y which should automatically create a package.json file for you and as well allow you to install node modules.
NB: You have npm installed on your machine already so running npm install npm -g is not ideal.
I got this error when my package.json referred to a package using file:../(local path) and the directory didn't exist. Pointing it to the correct path resolved the error.
In my case... none of the above worked. I then deleted my package-lock.json. When I ran an npm install I got an error that a certain package could not be found in the repository. When I removed that from package.json my npm install worked!
I had the same issue. In my case it was caused by a syntax error within the .npmrc file, which was manually edited
Method 1:
npm cache clean --force then install your package
Method 2:
Disable your antivirus software and try to install your package
Method 3:
It is your internet connection, if you are using Wifi or an Ethernet connection use your cellular network or a different network and try to install your package