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

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....

Related

Errors when using "npm start" (in MacOS)

I have been trying for sometime already to just run "npm start" for an old app developed with EmberJs but I get several errors. I had tried the following:
Uninstall, cache clean, install Ember-cli
Remove the "node_modules" and run "npm install"
Updating ember-cli-babel
And some few others like updating / removing packages
I haven't open this project for around 3 years so I am pretty sure there are new updates that probably I need to follow but not sure what else to do after the list I just mentioned above.
I uploaded what I get when running "npm start".
Any guidance, help, or suggestion I would appreciate it! Thanks in advance!!
user#User-MacBook-Air app2 % npm start
> app#0.0.0 start /Users/user/Projects/app2
> ember serve
DEPRECATION: ember-cli-babel 5.x has been deprecated. Please upgrade to at least ember-cli-babel 6.6. Version 5.2.8 located: app -> ember-clean-tmp -> ember-cli-babel
ember-cli-htmlbars-inline-precompile v1.0.0 and above require the ember-cli-babel v6.7.1 or above. To use ember-cli-babel v5.x please downgrade ember-cli-htmlbars-inline-precompile to v0.3.
An error occurred in the constructor for ember-cli-htmlbars-inline-precompile at /Users/user/Projects/app2/node_modules/ember-cli-htmlbars-inline-precompile
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app#0.0.0 start: `ember serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app#0.0.0 start 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! /Users/user/.npm/_logs/2022-04-17T17_03_00_039Z-debug.log
To make your life easier and get your app going faster, I’d suggest trying to stay in the Babel 5.x world and see how few dependencies you can update to start with. So I’d probably start by heading the suggestion in the warning and downgrade
ember-cli-htmlbars-inline-precompile v1.0.0 and above require the
ember-cli-babel v6.7.1 or above. To use ember-cli-babel v5.x please
downgrade ember-cli-htmlbars-inline-precompile to v0.3.
That may still mean you but other errors, but ideally you’d stick with the same ember, ember cli and ember data (and all associated dependencies) instead of trying to do a large and possibly time-consuming upgrade
Also, might be worth introducing a lock file (either using Yarn 1 or a Node 6 lock file if your system can run with it) so you don’t hit this issue in the future.

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

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.

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.

ran npm publish without error but cannot see updated package

I updated my version in package.json and ran "npm publish". I did not see any error and see the log "package-name prepublishOnly" in terminal. Now if I go to https://www.npmjs.com/package/, I could not see updated package. Then if I ran "npm publish" again, it gives me error as below:
npm ERR! publish Failed PUT 403
npm ERR! code E403
npm ERR! Forbidden The feed already contains the package 'package-name' at version 'X.Y.Z': 'package-name'
I would like to know why and if I publish the package successfully or not.
Give it some time. Your package is probably uploaded, the webpage might not be updated immediately yet.
I thought I was seeing the same thing with my package as of 11:38AM PT on 2/28/2019, as the page of my package would show the older version. However, when searching for my package I would see the new version. Most importantly, running npm init and npm install mypackage would install the new version, which is what matters the most anyway.

npm ERR! Unexpected end of JSON input while parsing near '...":{"shasum":"ae6c2edf'

npm ERR! Unexpected end of JSON input while parsing near '...":{"shasum":"ae6c2edf'
getting this error while npm install.
Steps i had done
1. create a new project
2. done npm install
getting this error for all new projects.
Cleaning the corrupted local npm cache may fix this error.
npm cache clean --force
Just run your npm command again after executing the above command in your terminal.
There could be few other reasons for the invalid JSON, as described in the official documentation here.
The official npm website has well documented most of the common errors. But unfortunately they don’t appear on the top results when you google the error.
updating angular cli to latest worked for me.