我安装了node.js。接下来,我用命令安装了cnmp。
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install当我尝试命令cnpm run dev时,出现了一个错误:
npm ERR! path C:\Users\Harry\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\Harry\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Harry\AppData\Roaming\npm-cache\_logs\2018-08-03T02_48_22_663Z-debug.log因此,我将package.json从C:\Users\Harry\AppData\Roaming\npm\node_modules\cnpm移到了'C:\Users\Harry\package.json',但仍然有一个错误:
npm ERR! missing script: dev
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Harry\AppData\Roaming\npm-cache\_logs\2018-08-03T02_51_46_194Z-debug.log我也尝试过类似的方法,比如在package.json中编辑脚本,它仍然不起作用。
发布于 2018-10-08 00:51:16
也许你使用的是Vue CLI 3?如果是,则没有"dev“构建脚本。Vue 2样板项目的早期版本有一个"dev“脚本,但现在没有了。
相反,使用"serve“脚本,您的Vue项目将作为dev运行
npm run serve请参阅package.json文件中使用Vue CLI 3配置的脚本。
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint" },希望这能解决你的问题。
https://stackoverflow.com/questions/51664680
复制相似问题