2

I have installed node.js. Next, I installed cnmp with command

npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install

when I tried command cnpm run dev there is a error:

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

so I moved the package.json from C:\Users\Harry\AppData\Roaming\npm\node_modules\cnpm to 'C:\Users\Harry\package.json' but I still got an error:

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

and I also tried methods of similar problems, such as edit the script in package.json, it still doesn't work.

4
  • After moving package.json, you will need to run cnpm install again Commented Aug 3, 2018 at 3:14
  • I tried but it still does not work...... Commented Aug 3, 2018 at 3:21
  • Did you check if your your package.json actually contains a scripts section with a dev command? Commented Aug 3, 2018 at 9:55
  • "scripts": { "test": "npm run lint -- --fix && npm run test-local", "test-local": "egg-bin test", "lint": "eslint bin lib test/*.js", "ci": "npm run lint && npm run test", "autod": "autod" }, it doesn't contain dev in scripts Commented Aug 3, 2018 at 17:12

1 Answer 1

13

Perhaps you are using the Vue CLI 3? If yes, there is no "dev" build script. Earlier versions of the Vue 2 boilerplate project had a "dev" script - but no longer.

Instead use the "serve" script and your Vue project will run as dev

npm run serve

See the scripts that are configured with Vue CLI 3 in the package.json file

"scripts": {
         "serve": "vue-cli-service serve",
         "build": "vue-cli-service build",
         "lint": "vue-cli-service lint"    },

Hope that solves your issue.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.