root权限:sudo

不到万不得已不要是要sudo权限

  1. npm WARN checkPermissions Missing write access to /Users/a1/github/samplate/node_modules/anymatch/node_modules
  2. npm WARN enoent ENOENT: no such file or directory, open '/Users/a1/github/samplate/node_modules/_debug@4.1.1@debug/package.json'
  3. npm WARN @webpack-contrib/schema-utils@1.0.0-beta.0 requires a peer of webpack@^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
  4. npm WARN ajv-keywords@3.4.0 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
  5. npm WARN webpack-dev-middleware@3.4.0 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.
  6. npm WARN ajv-keywords@3.4.0 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
  7. npm ERR! path /Users/a1/github/samplate/node_modules/_nervjs@1.3.13@nervjs/node_modules/nerv-shared
  8. npm ERR! code ENOENT
  9. npm ERR! errno -2
  10. npm ERR! syscall access
  11. npm ERR! enoent ENOENT: no such file or directory, access '/Users/a1/github/samplate/node_modules/_nervjs@1.3.13@nervjs/node_modules/nerv-shared'
  12. npm ERR! enoent This is related to npm not being able to find a file.
  13. npm ERR! enoent
  14. npm ERR! A complete log of this run can be found in:
  15. npm ERR! /Users/a1/.npm/_logs/2019-03-25T10_37_44_630Z-debug.log
  • teminal 终端出现了这个错误,警告中出现了 missing,这个是提示 root权限不允许,需要在npm 命令欠加 sudo。sudo是给予 root权限的,会车以后会出现一个 ?的密码,别担心:这个输入电脑登录密码就好,输入的时候屏 幕上不会出现几位数,是为了防止别人看到几位数来破解,输入密码后回车就好。
  • 下面出现了一个 no such file or directory, access ‘/Users/a1/github/samplate/node_modules/_nervjs@1.3.13@nervjs/node_modules/nerv-shared’

    这是少了什么包,下载那个缺失的包就好。输入 sudo npm install nerv-shared 就好,然后再运行sudo npm i ,继续 sudo npm i taro-ui - S ,继续往下进行。

  • 由于本次在npm的解决问题上使用了 cnpm 的install插曲, 所以需要 执行 cnpm i 的全部下载操作,然后再进行 sudo npm i /sudo npm i taro-ui -S 操作。cnpm需要翻墙。

  • 开发环境搭建的时候不需要翻墙,翻墙会下载很多不需要的东西,速度会很慢,下载的时候如果翻墙了中途不能中断,会出现很多问题,最好搭建的时候不要翻墙。
  1. npm -v
  2. node -v
  3. vi /Users/a1/.npm/_logs/2019-03-25T12_19_59_370Z-debug.log
  4. ls -la /Users/a1/github/samplate/node_modules/_@tarojs_async-await@1.2.21@@tarojs/async-await/node_modules/
  5. ls -la /Users/a1/github/samplate/node_modules/_@tarojs_async-await@1.2.21@@tarojs/async-await/node_module
  6. ls -la /Users/a1/github/samplate/node_modules/_@tarojs_async-await@1.2.21@@tarojs/async-await/node_modules
  7. ls -la /Users/a1/github/samplate/node_modules/_@tarojs_async-await@1.2.21@@tarojs/async-await/node_modules
  8. npm i
  9. cat package.json
  10. :q
  11. ls
  12. cat project.config.json
  13. ls -la config/
  14. ls -la config/index.js
  15. cat config/index.js
  16. cat ~/.npmrc
  17. history | grep npm
  18. cnpm i
  19. sudo rm -rf node_modules
  20. cnpm i