Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run dev error #118

Closed
torresyb opened this issue Dec 1, 2016 · 44 comments
Closed

npm run dev error #118

torresyb opened this issue Dec 1, 2016 · 44 comments

Comments

@torresyb
Copy link

torresyb commented Dec 1, 2016

以下是报错信息,不知道怎么回事?求解

ERROR in .//.0.0.1@vue-bulma-jump/src/index.js
Module parse failed: G:\works\vue-admin\node_modules.0.0.1@vue-bulma-jump\src\index.js Unexpected token (1:7)
You may need an appropriate loader to handle this file type.
| export BackToTop from './BackToTop'
| export default from './Jump'
|
@ ./
/.6.2.8@babel-loader/lib!./~/.10.0.2@vue-loader/lib/selector.js?type=script&index=0!./client/views/components/BackToTop.vue 50:0-43
@ ./client/views/components/BackToTop.vue
@ ./client/views async ^./.*.vue$
@ ./client/store/modules/menu/lazyLoading.js
@ ./client/store/modules/menu/index.js
@ ./client/router/index.js
@ ./client/app.js
@ ./client/index.js
@ multi app

ERROR in .//.0.0.1@vue-bulma-emoji/src/index.js
Module parse failed: G:\works\vue-admin\node_modules.0.0.1@vue-bulma-emoji\src\index.js Unexpected token (1:7)
You may need an appropriate loader to handle this file type.
| export filter from './filter'
|
| export EmojiIcon from './EmojiIcon'
@ ./
/.6.2.8@babel-loader/lib!./~/.10.0.2@vue-loader/lib/selector.js?type=script&index=0!./client/views/components/Emoji.vue 52:0-52
@ ./client/views/components/Emoji.vue
@ ./client/views async ^./.*.vue$
@ ./client/store/modules/menu/lazyLoading.js
@ ./client/store/modules/menu/index.js
@ ./client/router/index.js
@ ./client/app.js
@ ./client/index.js
@ multi app

ERROR in .//.0.0.4@vue-bulma-progress-tracker/src/index.js
Module parse failed: G:\works\vue-admin\node_modules.0.0.4@vue-bulma-progress-tracker\src\index.js Unexpected token (1:7)
You may need an appropriate loader to handle this file type.
| export StepItem from './StepItem'
| export default from './Tracker'
|
@ ./
/.6.2.8@babel-loader/lib!./~/.10.0.2@vue-loader/lib/selector.js?type=script&index=0!./client/views/components/ProgressTracker.vue 76 :0-71
@ ./client/views/components/ProgressTracker.vue
@ ./client/views async ^./.*.vue$
@ ./client/store/modules/menu/lazyLoading.js
@ ./client/store/modules/menu/index.js
@ ./client/router/index.js
@ ./client/app.js
@ ./client/index.js
@ multi app

@fundon
Copy link
Member

fundon commented Dec 2, 2016

请问已经更新到最新的源代码了吗?

@torresyb
Copy link
Author

torresyb commented Dec 2, 2016

恩,是的,更新的最新代码。就是跑步起来,报上面的错

@fundon
Copy link
Member

fundon commented Dec 3, 2016

说下你的环境,node、npm 等。

@torresyb
Copy link
Author

torresyb commented Dec 4, 2016

$ node -v
v6.9.1
$ npm -v
4.0.2
$ webpack -v
2.1.0-beta.27

@fundon fundon added the webpack label Dec 5, 2016
@Pluto1219
Copy link

me too

@fundon
Copy link
Member

fundon commented Dec 6, 2016

Retry after npm update -d

@fundon fundon added the npm label Dec 6, 2016
@fundon
Copy link
Member

fundon commented Dec 7, 2016

@torresyb @qcdys Is it still here?

@slipkinem
Copy link

我的情况也是报一样的错,是不是用 cnpm install 的原因?npm run dev/build error

@fundon
Copy link
Member

fundon commented Dec 8, 2016

Following the steps:

  1. rm -rf node_modules
  2. npm i -d
  3. npm run dev

@violacase
Copy link

Me too.

webpack 2.1.0-beta.25
removed node_modules

command: npm i -d
echo'd:

npm info it worked if it ends with ok
npm info using npm@3.10.9
npm info using node@v6.9.1
npm ERR! Windows_NT 10.0.14393

etc...

@Pluto1219
Copy link

好了

@fundon
Copy link
Member

fundon commented Dec 12, 2016

@qcdys 请问你是按照我的步骤来的吗?

@Pluto1219
Copy link

@fundon 是的
如果左侧的菜单区域可以做成向左收起的话、 那就更棒了

@luventa
Copy link
Member

luventa commented Dec 13, 2016

@qcdys 左侧菜单是可以收起的,浏览器宽度小于768就会自动隐藏菜单并在左上角显示打开菜单的按钮。
这段代码在App.vue的beforemount里面

@Pluto1219
Copy link

@luventa 好的、 谢啦

@violacase
Copy link

Sorry guys. I'm a Dutch guy. I can't read chinese.

@luventa
Copy link
Member

luventa commented Dec 13, 2016

@violacase qcdys strictly followed the steps that Fundon mentioned, and it worked fine.

@15059492071
Copy link

我在国内,用cnpm,还是报同样的错

@violacase
Copy link

violacase commented Dec 13, 2016

Thx, luventa.

Sure this is tested on WIndows10 OS machine?

Error log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\Kees\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'dev' ]
2 info using npm@3.10.9
3 info using node@v6.9.1
4 verbose stack Error: ENOENT: no such file or directory, open 'W:\___xamp\htdocs\apps\untouched\vue-admin\package.json'
4 verbose stack     at Error (native)
5 verbose cwd W:\___xamp\htdocs\apps\untouched\vue-admin
6 error Windows_NT 10.0.14393
7 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Kees\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
8 error node v6.9.1
9 error npm  v3.10.9
10 error path W:\___xamp\htdocs\apps\untouched\vue-admin\package.json
11 error code ENOENT
12 error errno -4058
13 error syscall open
14 error enoent ENOENT: no such file or directory, open 'W:\___xamp\htdocs\apps\untouched\vue-admin\package.json'
15 error enoent ENOENT: no such file or directory, open 'W:\___xamp\htdocs\apps\untouched\vue-admin\package.json'
15 error enoent This is most likely not a problem with npm itself
15 error enoent and is related to npm not being able to find a file.
16 verbose exit [ -4058, true ]

@luventa
Copy link
Member

luventa commented Dec 13, 2016

@violacase can you check whether file package.json does exist under directory vue-admin\ or not?
According to this line in your error log, it seems that the file is missing.
no such file or directory, open 'W:\___xamp\htdocs\apps\untouched\vue-admin\package.json'

@violacase
Copy link

violacase commented Dec 14, 2016

It works!
Thx luventa et all. I don't know what went wrong. I tried to install it a couple of times last week but it always failed.
Today I tried again to be absolutely sure and guess? All installed well without a single issue.
Thanks again. Keep up the good work!

@movefreechen
Copy link

刚开始我也是怎么都报错,重新搞一下依赖也好了,还有你的 webpack配置项我貌似在哪见过

@fundon
Copy link
Member

fundon commented Dec 15, 2016

@luventa 可以把这段写进文档里面,看这里 https://github.com/vue-bulma/vue-admin/issues/118#issuecomment-265669461。

@luventa
Copy link
Member

luventa commented Dec 15, 2016

@fundon 没问题

@violacase
Copy link

I found out why it didn't work with me. This webpack uses port 8080. If this port is already served by another process the built errors.
Hint: Alter the server configuration for using a FREE port.

@fundon
Copy link
Member

fundon commented Dec 20, 2016

@violacase I added an option DEV_PORT for dev server. See 9292718.

We can set env for running. If you use fish shell, try env DEV_PORT=3030 npm run dev.

@hjpyh-ybxrz
Copy link

为什么一直报错呢,npm i -d,是window 10的原因吗。。

@fundon
Copy link
Member

fundon commented Dec 29, 2016

@hjpyh-ybxrz 试过清空 node_modules吗?

@figoxu
Copy link

figoxu commented Jan 2, 2017

@atmfans 请问,你是如何从新搞一下依赖的?

@solody
Copy link

solody commented Jan 3, 2017

Me too,fuck,沒有一次能跑成功

@luventa
Copy link
Member

luventa commented Jan 3, 2017

Try yarn. npm install yarn -g, then execute yarn install under the same directory you ran npm install.
Registry https://registry.npm.taobao.org/ could be useful.
Also, you can check Vue admin wiki for more info.

跑不成功可能是因为依赖下载的问题。
可以先手动的删除整个node_modules文件夹
如果npm很慢,可以试一下yarn这个工具。
另外cnpm可能不如把registry改成taobao镜像好用。
最后一定要注意,你需要装Git Bash,在Git Bash里面运行npm install或者yarn install (如果你安装了yarn)
有问题可以再查一下Vue admin wiki

@fundon
Copy link
Member

fundon commented Jan 3, 2017

@figoxu 按这个步骤解决了吗? #118 (comment)

@zyupo
Copy link

zyupo commented Jan 22, 2017

Centos7 上面npm run dev error报错解决方法:

1. rm -rf node_modules
2. npm cache clean
3. npm i -d --registry=https://registry.npm.taobao.org
4. npm run dev

@SilkYer
Copy link

SilkYer commented Feb 15, 2017

你好 我用了vue.cli已经成功运行了localhost:8080的cli模板了 然后关机睡觉了 第二天还在原路径下运行cpn run dev .命令行窗口说is related to npm not being able to find a file...

@figoxu
Copy link

figoxu commented Feb 15, 2017

@fundon I am using yarn install , It is ok
#130

@luventa
Copy link
Member

luventa commented Feb 15, 2017

@soloSpring 你这个是vue-cli的问题吧? cpn是哪个?

@SilkYer
Copy link

SilkYer commented Feb 15, 2017

@luventa npm run dev 就是运行的那个命令 昨天输入这行命令之后 就直接打开模板了 今天就说 related to npm not being able to find a file...

@luventa
Copy link
Member

luventa commented Feb 15, 2017

@soloSpring 找个文件夹重新运行这些命令吧。这个错误信息很多情况都会出现,比如有可能你运行npm run dev的路径不正确。

vue init webpack-simple test
cd test -> 注意这句
npm install -> 确保install是成功的没有error
npm run dev

另外强烈推荐用yarn,国内不成功的情况大多是因为网络问题导致依赖下载失败。
条件允许的话开vpn或者ss会更好

@SilkYer
Copy link

SilkYer commented Feb 15, 2017

@luventa 啊..又要重新建立一个模板啊 我看了下 我进入了模板路径 就是cd text 后 再运行npm run dev 就弹出来这个
C:\Users\solofeng\sell\config\index.js:13
npm ERR! enoent and is related to npm not being able to find a filear static hosts such as
^^^
SyntaxError: Unexpected identifier
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (C:\Users\solofeng\sell\build\dev-server.js:3:14)
at Module._compile (module.js:570:32)

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "dev"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! sell@1.0.0 dev: node build/dev-server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sell@1.0.0 dev script 'node build/dev-server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sell package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build/dev-server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs sell
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls sell
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\solofeng\sell\npm-debug.log

我粗略看了下 好像说我npm 和node版本不对 可是npm和node是我昨天才下的 并且成功运行过的啊..TAT

@luventa
Copy link
Member

luventa commented Feb 16, 2017

@soloSpring 不是node版本问题。
·enoent and is related to npm not being able to find a filear static hosts such as·

npm run dev的位置有问题吧

@guoshengbo
Copy link

npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\gsb\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "node-sass" "-d"
npm ERR! node v7.2.0
npm ERR! npm v4.1.1
npm ERR! code ELIFECYCLE

npm ERR! node-sass@4.5.0 postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.5.0 postinstall script 'node scripts/build.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-sass
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\gsb\Desktop\ll\vue-admin-0.1.12\npm-debug.log
在安装依赖的时候报这个错是为什么啊? 我试着重新npm install node-sass 还是报这个错

@luventa
Copy link
Member

luventa commented Feb 23, 2017

@guoshengbo 我记得node-sass需要python 2.x
然后如果网络不好的话,node-sass的安装也会一直出错。建议挂个代理或者用淘宝镜像

@fundon
Copy link
Member

fundon commented Mar 3, 2017

都是 node-sass 的锅

@anson-GH
Copy link

change the config >index.js port: 8080 to other port eg, port: 8081

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests