homestead执行npm run dev 报错missing script: dev

使用homestead的时候,执行npm run dev ,各种错误:

  1. Cannot find module node_modules/cross-env/dist/bin/cross-env.js

    npm i cross-env

  2. peer independence 依赖报错
    npm i npm-install-peers
  3. no such file or directory, open '/home/vagrant/package.json' 报错
    npm init
  4. 最新的问题,执行执行npm run dev 报错:missing script: dev
npm ERR! missing script: dev

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vagrant/.npm/_logs/2018-05-30T03_23_37_043Z-debug.log
vagrant@homestead:~$ cat /home/vagrant/.npm/_logs/2018-05-30T03_23_37_043Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'dev' ]
2 info using npm@6.1.0
3 info using node@v8.11.2
4 verbose config Skipping project config: /home/vagrant/.npmrc. (matches userconfig)
5 verbose stack Error: missing script: dev
5 verbose stack     at run (/usr/lib/node_modules/npm/lib/run-script.js:151:19)
5 verbose stack     at /usr/lib/node_modules/npm/lib/run-script.js:61:5
5 verbose stack     at /usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:115:5
5 verbose stack     at /usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:418:5
5 verbose stack     at checkBinReferences_ (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:373:45)
5 verbose stack     at final (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:416:3)
5 verbose stack     at then (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:160:5)
5 verbose stack     at ReadFileContext.<anonymous> (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:332:20)
5 verbose stack     at ReadFileContext.callback (/usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16)
5 verbose stack     at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:420:13)
6 verbose cwd /home/vagrant
7 verbose Linux 4.15.0-20-generic
8 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
9 verbose node v8.11.2
10 verbose npm  v6.1.0
11 error missing script: dev
12 verbose exit [ 1, true ]

有大佬遇到这个问题吗?

阅读 10k
3 个回答

package.json 里面没有 "scripts": {"dev": "xxx"}

新手上路,请多包涵

有的,但还是报错
clipboard.png

还是会报错,,,重建能启动,,但是吧以前写的代码放进去就不行了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏