centos7.2安装nodejs、npm走过的坑

 我的环境是win7上装的Oracle VM VirtualBox  

linux系统是centos7.2

安装

wget -c https://nodejs.org/dist/v10.9.0/node-v10.9.0-linux-x64.tar.xz
xz -d node-v10.9.0-linux-x64.tar.xz
tar -xvf node-v10.9.0-linux-x64.tar
mv node-v10.9.0-linux-x64 /usr/local/
ln -s /usr/local/node-v10.9.0-linux-x64/bin/node /usr/local/bin/node
ln -s /usr/local/node-v10.9.0-linux-x64/bin/npm /usr/local/bin/npm
node -v
npm -v
cd /data/httpd/kangaroo_mini_app
npm cache clean --force
npm i

 

接二连三的warning、error  。。。

1、npm ERR! rofs EROFS: read-only file system, symlink '../eslint/bin/eslint.js' ->

解决方法:Enable symlinks

 

VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1
Or on Windows

VBoxManage.exe setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1
where VM_NAME is the name of your virtual machine (e.g Ubuntu) and SHARE_NAME the name of your shared directory (without the "sf_" prefix).

This will re-enable the previous symlink friendly behavior.

Note: On Windows, always restart the Virtual Machine AND VirtualBox GUI.

 

我的是win7上的虚拟机

cmd以管理员身份打开

D:\Program Files\Oracle\VirtualBox>VBoxManage.exe setextradata centos64 VBoxInternal2/SharedFoldersEnableSymlinksCreate/share 1

其中:centos64是虚拟机名称 share是共享文件夹的名称

 

2、npm ERR! Error: EPERM: operation not permitted, rename

npm ERR! Error: EPERM: operation not permitted, rename '/data/httpd/kangaroo_mini_app/node_modules/.staging/abbrev-08eaebb8' -> '/data/httpd/kangaroo_mini_app/node_modules/abbrev'
npm ERR!     at destStatted (/usr/lib/node_modules/npm/lib/install/action/finalize.js:25:7)
npm ERR!     at /usr/lib/node_modules/npm/node_modules.bundled/graceful-fs/polyfills.js:264:29
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR! 
npm ERR! Error: EPERM: operation not permitted, rename '/data/httpd/kangaroo_mini_app/node_modules/.staging/abbrev-08eaebb8' -> '/data/httpd/kangaroo_mini_app/node_modules/abbrev'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, rename '/data/httpd/kangaroo_mini_app/node_modules/.staging/abbrev-08eaebb8' -> '/data/httpd/kangaroo_mini_app/node_modules/abbrev'
npm ERR!     at destStatted (/usr/lib/node_modules/npm/lib/install/action/finalize.js:25:7)
npm ERR!     at /usr/lib/node_modules/npm/node_modules.bundled/graceful-fs/polyfills.js:264:29
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR! 
npm ERR! Error: EPERM: operation not permitted, rename '/data/httpd/kangaroo_mini_app/node_modules/.staging/abbrev-08eaebb8' -> '/data/httpd/kangaroo_mini_app/node_modules/abbrev'
npm ERR!     at Error (native) parent: 'kangaroo' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /data/httpd/kangaroo_mini_app/npm-debug.log

解决方法:关掉win7环境的360

 

后来再执行安装

3、npm ERR! ETXTBSY: text file is busy, rename

npm cache clean --force
npm i
#不行 还是报错 npm ERR! ETXTBSY: text file is busy, rename
npm cache clean --force
npm rebuild node-sass --no-bin-links
npm install --no-bin-links
#不行 还是报错 npm ERR! ETXTBSY: text file is busy, rename
npm install -f

还是报错

 

失望了   改装yarn了

npm cache clean --force
npm install -g yarn
ln -s /usr/local/node-v10.9.0-linux-x64/bin/yarn /usr/local/bin/yarn
[root@localhost kangaroo_mini_app]# yarn install
yarn install v1.9.4
warning package.json: No license field
info No lockfile found.
warning kangaroo@1.0.12: No license field
[1/4] Resolving packages...
warning stylelint > autoprefixer > browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning wepy-plugin-imagemin > imagemin-pngquant > pngquant-bin > bin-wrapper > download > gulp-decompress > gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
[2/4] Fetching packages...
info fsevents@1.2.4: The platform "linux" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > wepy-eslint@1.5.4" has incorrect peer dependency "eslint-friendly-formatter@>=2.0.0 < 3.0.0".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 538.95s.
[root@localhost kangaroo_mini_app]#yarn run dev
yarn run v1.9.4
warning package.json: No license field
$ run-p start watch:font
warning package.json: No license field
warning package.json: No license field
$ onchange 'icons/*.svg' -- npm run font-build
$ wepy build --watch
/bin/sh: wepy: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with signal "SIGTERM".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "start" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[root@localhost kangaroo_mini_app]# npm install wepy-cli -g
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
/usr/local/node-v10.9.0-linux-x64/bin/wepy -> /usr/local/node-v10.9.0-linux-x64/lib/node_modules/wepy-cli/bin/wepy.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/wepy-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ wepy-cli@1.7.3
added 462 packages from 296 contributors in 41.131s
[root@localhost kangaroo_mini_app]# yarn run dev
yarn run v1.9.4
warning package.json: No license field
$ run-p start watch:font
warning package.json: No license field
warning package.json: No license field
$ wepy build --watch
$ onchange 'icons/*.svg' -- npm run font-build
[05:46:49] [编译] 入口: src/app.wpy

到此可以了

 

 

 

 

其他情况:

yarn add webpack webpack-cli --save-dev

yarn add v1.9.4
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.4: The platform "linux" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
error An unexpected error occurred: "EPROTO: protocol error, symlink '../../../acorn/bin/acorn' -> '/data/httpd/webpack-demo/node_modules/acorn-dynamic-import/node_modules/.bin/acorn'".
info If you think this is a bug, please open a bug report with the information provided in "/data/httpd/webpack-demo/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

改为:yarn add webpack webpack-cli --save-dev --no-bin-links 

 

 

 

2018.10.17 15:00:00

error An unexpected error occurred: "EPROTO: protocol error, symlink '../jsesc/bin/jsesc' -> '/data/httpd/ec

https://github.com/npm/npm/issues/9901上看到下面有这样回复的  

If you don't want to run virtualbox as administrator, you can allow creating symbolic links for all users:

  1. Open the Local Group Policy Editor (gpedit.msc)
  2. Edit the Create symbolic links policy at:

Computer configuration → Windows Settings → Security Settings → Local Policies → User Rights Assignment → Create symbolic links

便按照此尝试了下  发现成功解决了这个问题  不用再要加上--no-bin-links了

 

 

选择一个  确定 、然后点击应用、 确定即可

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值