anthonygore / vue-casl-demo

Repo for the article "Managing User Permissions in a VueJS App"
https://vuejsdevelopers.com/2018/01/08/vue-js-roles-permissions-casl/
60 stars 21 forks source link

npm install results in errors #1

Open WaldemarEnns opened 4 years ago

WaldemarEnns commented 4 years ago

Problem

When i try to install the dependencies, the following errors are being showed:

Console output

npm install
npm WARN deprecated casl@1.1.0: CASL is split into few packages. Check CASL repository for more info
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN notsup Unsupported engine for casl@1.1.0: wanted: {"npm":"^3.0.0"} (current: {"node":"12.6.0","npm":"6.13.1"})
npm WARN notsup Not compatible with your version of node/npm: casl@1.1.0

npm ERR! Unexpected end of JSON input while parsing near '...4.0","lodash.uniq":"^'

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/enux/.npm/_logs/2020-01-31T09_50_32_392Z-debug.log

Logfile output

[...]
1902 silly saveTree ├── casl@1.1.0
1902 silly saveTree └── express@4.17.1
1903 warn notsup Unsupported engine for casl@1.1.0: wanted: {"npm":"^3.0.0"} (current: {"node":"12.6.0","npm":"6.13.1"})
1904 warn notsup Not compatible with your version of node/npm: casl@1.1.0
1905 verbose notsup Not compatible with your version of node/npm: casl@1.1.0
1905 verbose notsup Required: {"npm":"^3.0.0"}
1905 verbose notsup Actual:   {"npm":"6.13.1","node":"12.6.0"}
1906 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...4.0","lodash.uniq":"^'
1906 verbose stack     at JSON.parse (<anonymous>)
1906 verbose stack     at parseJson (/usr/local/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
1906 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50
1906 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:85:5)
1907 verbose cwd /Volumes/Samsung_T5/private/vue-casl-demo
1908 verbose Darwin 19.2.0
1909 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
1910 verbose node v12.6.0
1911 verbose npm  v6.13.1
1912 error Unexpected end of JSON input while parsing near '...4.0","lodash.uniq":"^'
1913 verbose exit [ 1, true ]

How to reproduce

Seems to be a similar error as i get on the official casl-vue example: https://github.com/stalniy/casl-vue-api-example/issues/5

Could you take a look at it and maybe fix the dependencies? It seems that CASL was split up into different packages, which now have to be updated ...

EDIT

I could resolve my issue on https://github.com/stalniy/casl-vue-api-example/issues/5 . I just had ro run npm ci and could install the whole package-dependencies with the package-lock.json.

I wanted to do it in this case here too, but i couldn't, since it has no package-lock.json.

n4j1Br4ch1D commented 3 years ago

for me when I run npm install I get this error : npm ERR! Unexpected end of JSON input while parsing near '...ICT+J7HIj5T2Lt1jTBwoX' how I fixed it: on windows10 : 1- I run rm -rf node_modules to delete the node_modules folder. 2- then did npm cache clear --force. 3- run npm install again. and it worked.

gingerman commented 3 years ago

Hi, I altered part of the template to look like this - and this works after updating npm etc.

<post
  v-for="post in posts"
  :key="post"
  v-bind:post="post"
  v-bind:username="getUserName(post)"
  @delete-post="deletePost"
  @err="updateErr"
></post>

Seems like we need to define the key.