我已经全局安装了nodejs v10.19.0
。
我首先拥有npm(在我的项目分支和root上):
valentin@valentin:~$ npm i -g @vue/cli
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 rm not removing /home/valentin/.npm-global/bin/vue as it wasn't installed by /home/valentin/.npm-global/lib/node_modules/@vue/cli
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/@vue/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/@vue/cli/bin/vue.js
npm ERR! dest /home/valentin/.npm-global/bin/vue
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/@vue/cli/bin/vue.js' -> '/home/valentin/.npm-global/bin/vue'
npm ERR! File exists: /home/valentin/.npm-global/bin/vue
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/valentin/.npm/_logs/2020-02-08T10_36_35_054Z-debug.log
valentin@valentin:~$ npm i -g @vue/cli --force
npm WARN using --force I sure hope you know what you are doing.
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.
/home/valentin/.npm-global/bin/vue -> /home/valentin/.npm-global/lib/node_modules/@vue/cli/bin/vue.js
> fsevents@1.2.11 install /home/valentin/.npm-global/lib/node_modules/@vue/cli/node_modules/fsevents
> node-gyp rebuild
make: Entering directory '/home/valentin/.npm-global/lib/node_modules/@vue/cli/node_modules/fsevents/build'
SOLINK_MODULE(target) Release/obj.target/.node
COPY Release/.node
make: Leaving directory '/home/valentin/.npm-global/lib/node_modules/@vue/cli/node_modules/fsevents/build'
> core-js@2.6.11 postinstall /home/valentin/.npm-global/lib/node_modules/@vue/cli/node_modules/babel-polyfill/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
> core-js@2.6.11 postinstall /home/valentin/.npm-global/lib/node_modules/@vue/cli/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js@3.6.4 postinstall /home/valentin/.npm-global/lib/node_modules/@vue/cli/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> @apollo/protobufjs@1.0.3 postinstall /home/valentin/.npm-global/lib/node_modules/@vue/cli/node_modules/@apollo/protobufjs
> node scripts/postinstall
> nodemon@1.19.4 postinstall /home/valentin/.npm-global/lib/node_modules/@vue/cli/node_modules/nodemon
> node bin/postinstall || exit 0
> ejs@2.7.4 postinstall /home/valentin/.npm-global/lib/node_modules/@vue/cli/node_modules/ejs
> node ./postinstall.js
Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)
+ @vue/cli@4.2.2
added 1178 packages from 661 contributors in 40.25s
valentin@valentin:~$ vue --version
Command 'vue' not found, did you mean:
command 'vpe' from deb texlive-latex-extra
Try: sudo apt install <deb name>
valentin@valentin:~/code/Vue.js/Vue Mastery/Real World Vue.js$ npm i core-js
> core-js@3.6.4 postinstall /home/valentin/code/Vue.js/Vue Mastery/Real World Vue.js/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
npm WARN saveError ENOENT: no such file or directory, open '/home/valentin/code/Vue.js/Vue Mastery/Real World Vue.js/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/valentin/code/Vue.js/Vue Mastery/Real World Vue.js/package.json'
npm WARN Real World Vue.js No description
npm WARN Real World Vue.js No repository field.
npm WARN Real World Vue.js No README data
npm WARN Real World Vue.js No license field.
+ core-js@3.6.4
updated 1 package and audited 469 packages in 1.471s
3 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
valentin@valentin:~$ npm outdated
Package Current Wanted Latest Location
@vue/babel-preset-app 4.1.0 4.2.2 4.2.2 global
我用纱,输出为:
valentin@valentin:~$ yarn global add @vue/cli
yarn global v1.21.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.11: The platform "linux" is incompatible with this module.
info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "@vue/cli@4.2.2" with binaries:
- vue
Done in 2.65s.
valentin@valentin:~$ vue --version
Command 'vue' not found, did you mean:
command 'vpe' from deb texlive-latex-extra
Try: sudo apt install <deb name>
如您所见,这是一个永无止境的过程。我在堆栈,git等上读取了许多线程,但是它们没有帮助。也许是因为我在安装vue / cli之前没有安装nodejs,但是后来我清除了nodejs并安装了,尝试再次安装vue / cli,但没有成功。
如果将这2个安装在项目的分支上,或者如果是全局安装的话,安装在根目录上,这有什么区别?我认为这也不是问题。