有类似的问题,
我也尝试过 sudo npm install,首先导致以下错误,并导致异步意外令牌错误。
npm WARN checkPermissions Missing write access to /home/mohanbabu/node_modules
npm WARN enoent ENOENT: no such file or directory, open '/home/mohanbabu/package.json'
npm WARN mohanbabu No description
npm WARN mohanbabu No repository field.
npm WARN mohanbabu No README data
npm WARN mohanbabu No license field.
npm ERR! path /home/mohanbabu/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/home/mohanbabu/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/home/mohanbabu/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/home/mohanbabu/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/home/mohanbabu/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/mohanbabu/.npm/_logs/2019-10-13T16_51_12_932Z-debug.log
(async () => { ^ SyntaxError: Unexpected token ( at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:549:28)在 Object.Module._extensions..js (module.js:586:10) 在 Module.load (module.js:494:32) 在 tryModuleLoad (module.js:453:12) 在 Function.Module._load (module .js:445:3) 在 Module.runMain (module.js:611:10) 在运行时 (bootstrap_node.js:394:7) 在启动时 (bootstrap_node.js:160:9)
- 删除包锁并运行 npm install 是解决方法。(没有 sudo )
- 检查您的节点版本
- 运行 js 脚本(对于我的项目 npm start )