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

Examples npm run dev failing #45

Closed
mrpintcom opened this issue May 7, 2015 · 20 comments · Fixed by #49
Closed

Examples npm run dev failing #45

mrpintcom opened this issue May 7, 2015 · 20 comments · Fixed by #49

Comments

@mrpintcom
Copy link

I've been having troubles running "npm run build" from examples/gh-pages

npm-debug.log outputs the following:

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/Users/lukepint/.node/bin/npm', 'run', 'dev' ]
2 info using npm@2.8.4
3 info using node@v0.12.0
4 verbose node symlink /usr/local/bin/node
5 verbose run-script [ 'predev', 'dev', 'postdev' ]
6 info predev gh-pages@1.0.0
7 info dev gh-pages@1.0.0
8 verbose unsafe-perm in lifecycle true
9 info gh-pages@1.0.0 Failed to exec dev script
10 verbose stack Error: gh-pages@1.0.0 dev: `npm run clean && webpack-dev-server --content-base ../../public`
10 verbose stack Exit status 1
10 verbose stack     at EventEmitter.<anonymous> (/Users/lukepint/.node/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
10 verbose stack     at EventEmitter.emit (events.js:110:17)
10 verbose stack     at ChildProcess.<anonymous> (/Users/lukepint/.node/lib/node_modules/npm/lib/utils/spawn.js:24:14)
10 verbose stack     at ChildProcess.emit (events.js:110:17)
10 verbose stack     at maybeClose (child_process.js:1008:16)
10 verbose stack     at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
11 verbose pkgid gh-pages@1.0.0
12 verbose cwd /Users/lukepint/workspace/boomplans/react-google-maps-master/examples/gh-pages
13 error Darwin 14.0.0
14 error argv "node" "/Users/lukepint/.node/bin/npm" "run" "dev"
15 error node v0.12.0
16 error npm  v2.8.4
17 error code ELIFECYCLE
18 error gh-pages@1.0.0 dev: `npm run clean && webpack-dev-server --content-base ../../public`
18 error Exit status 1
19 error Failed at the gh-pages@1.0.0 dev script 'npm run clean && webpack-dev-server --content-base ../../public'.
19 error This is most likely a problem with the gh-pages package,
19 error not with npm itself.
19 error Tell the author that this fails on your system:
19 error     npm run clean && webpack-dev-server --content-base ../../public
19 error You can get their info via:
19 error     npm owner ls gh-pages
19 error There is likely additional logging output above.
20 verbose exit [ 1, true ]

In addition, I found this in the output of the run:

{ file: '/Users/lukepint/workspace/boomplans/examples/gh-pages/node_modules/bootstrap-sass/assets/stylesheets/bootstrap/mixins/_grid.scss' }
/Users/lukepint/workspace/boomplans/examples/gh-pages/node_modules/webpack-dev-server/node_modules/webpack-dev-middleware/middleware.js:85
            if(err) throw err;
                          ^
TypeError: tmp/server.js
--------------------------------------------------------------------------------options must be an object
    at TypeError (native)
    at Object.exports.createScript (vm.js:44:10)
    at module.exports (/Users/lukepint/workspace/boomplans/examples/gh-pages/node_modules/eval/eval.js:55:8)
    at IsomorphicReactPluginFactory.evaluate (/Users/lukepint/workspace/boomplans/examples/gh-pages/IsomorphicReactPluginFactory.js:56:12)
    at IsomorphicReactPluginFactory.runCompilation (/Users/lukepint/workspace/boomplans/examples/gh-pages/IsomorphicReactPluginFactory.js:68:32)
    at IsomorphicReactPluginFactory.receivedClientAssets (/Users/lukepint/workspace/boomplans/examples/gh-pages/IsomorphicReactPluginFactory.js:33:10)
    at ClientPlugin.<anonymous> (/Users/lukepint/workspace/boomplans/examples/gh-pages/IsomorphicReactPluginFactory.js:97:24)
    at Tapable.applyPluginsAsync (/Users/lukepint/workspace/boomplans/examples/gh-pages/node_modules/webpack/node_modules/tapable/lib/Tapable.js:71:13)
    at Tapable.Compiler.emitAssets (/Users/lukepint/workspace/boomplans/examples/gh-pages/node_modules/webpack/lib/Compiler.js:216:7)
    at Watching.<anonymous> (/Users/lukepint/workspace/boomplans/examples/gh-pages/node_modules/webpack/lib/Compiler.js:45:18)
--------------------------------------------------------------------------------

Can you provide any insight into why this might be failing?

Thanks

@tomchentw
Copy link
Owner

I believe you didn't type npm i in the root of the repo, right?

Never mind, I fixed the webpack.config.js to resolve it here so you just need to type npm i and npm run dev inside examples/gh-pages.

Please let me know if it works, thanks!

@mrpintcom
Copy link
Author

Thanks for the fast reply, unfortunately it's still not working.

The webpack compiles until if fails with this error:

TypeError: tmp/server.js
--------------------------------------------------------------------------------options must be an object
    at TypeError (native)
    at Object.exports.createScript (vm.js:44:10)
    at module.exports (/Users/lukepint/workspace/boomplans/examples/gh-pages/node_modules/eval/eval.js:55:8)
    at IsomorphicReactPluginFactory.evaluate (/Users/lukepint/workspace/boomplans/examples/gh-pages/IsomorphicReactPluginFactory.js:56:12)
    at IsomorphicReactPluginFactory.runCompilation (/Users/lukepint/workspace/boomplans/examples/gh-pages/IsomorphicReactPluginFactory.js:68:32)
    at IsomorphicReactPluginFactory.receivedClientAssets (/Users/lukepint/workspace/boomplans/examples/gh-pages/IsomorphicReactPluginFactory.js:33:10)
    at ClientPlugin.<anonymous> (/Users/lukepint/workspace/boomplans/examples/gh-pages/IsomorphicReactPluginFactory.js:97:24)
    at Tapable.applyPluginsAsync (/Users/lukepint/workspace/boomplans/examples/gh-pages/node_modules/webpack/node_modules/tapable/lib/Tapable.js:71:13)
    at Tapable.Compiler.emitAssets (/Users/lukepint/workspace/boomplans/examples/gh-pages/node_modules/webpack/lib/Compiler.js:216:7)
    at Watching.<anonymous> (/Users/lukepint/workspace/boomplans/examples/gh-pages/node_modules/webpack/lib/Compiler.js:45:18)
--------------------------------------------------------------------------------

So it seems to be something not compiling right. I'm running on Mac OSX 10.10.1 but wouldn't think that should matter.

I actually tried cloning installing and running on 2 Macs and they fail at the same spot.

@mrpintcom
Copy link
Author

Here's a gist of what's happening:

https://gist.github.com/lapint/3ed3ea184bfdf0def81a

@mrpintcom
Copy link
Author

I was able to find a working version here:

react-google-maps lukepint$ git checkout 338234a0545f9c7f7de79d5fe1a5b65540265c44
HEAD is now at 338234a... Merge pull request #37 from tomchentw/chore-update-dev-deps

@idolize
Copy link
Collaborator

idolize commented May 7, 2015

Likewise seeing this error when building the example pages.

npm ERR! code ELIFECYCLE
npm ERR! gh-pages@1.0.0 build_client: npm run clean && webpack -p
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gh-pages@1.0.0 build_client script 'npm run clean && webpack -p'.
npm ERR! This is most likely a problem with the gh-pages package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run clean && webpack -p

(This is on a fresh clone/install)

@mrpintcom
Copy link
Author

I'm wondering if this is an issue with what version of node is being used server side.

Running this version:
git checkout 931aaab

Causes "npm run dev" to fail and it is when the app was converted to an isometric one.

Looks like it's coming from eval.createScript() not being able to parse the content being passed into it maybe.

@idolize
Copy link
Collaborator

idolize commented May 7, 2015

I don't know much about Webpack (I use Browserify)... Is there even a server involved when running just webpack -p (not webpack-dev-server)? Because that fails for me as well.

@mrpintcom
Copy link
Author

webpack-dev-server still uses webpack, it just starts up a dev server for it as well.

The problem is that IsomorphicReactPluginFactory.js compiles all the required js into a component and then uses React.renderToString(ServerComponent) to render the client side from the server component.

I think eval could be the culprit, but not exactly sure how to fix it at this point.

@mrpintcom
Copy link
Author

I was able to fix the issue on master, I changed line 56 of IsomorphicReactPluginFactory.js
from: return evaluate(source, includeGlobals);
to: return eval(source, includeGlobals);

It's not the best since it uses javascript eval but it allows the server to start.

@tomchentw
Copy link
Owner

Sorry I missed the thread, I'm considering this issue might be related to versioning issues of node and npm. I'm running on node: v0.10.38 and npm 2.7.5

@tomchentw
Copy link
Owner

Got the same error today at node@0.12

options must be an object

@tomchentw
Copy link
Owner

Thanks @lapint for spotting eval might be the issue. I guess it's due to old API used for eval@0.1.0 but it's incompatible with node@0.12.
Switch to a new module called eval-as-module solve this problem.

@urban
Copy link

urban commented May 14, 2015

I'd like to contribute to this project with however I'm running into the following error even in node@0.10 when running npm run dev.

ERROR in ./~/react-toastr/lib/ToastMessage/jQueryMixin.js
Module not found: Error: Cannot resolve module 'jquery' in

Any quick solutions to fix this or remove the dependency?

@tomchentw
Copy link
Owner

@urban hmm in latest master branch, jQuery is included as devDependencies. Could you check your node_modules if it exists?

@urban
Copy link

urban commented May 15, 2015

@tomchentw Yes, you are right. When I wrote my earlier post, I didn't realize I was in your chore-node-012-compatibility branch, which is a WIP and not the master branch. Sorry for the inconvenience.

@tomchentw
Copy link
Owner

No worries @urban ! Glad it works now.

@idolize
Copy link
Collaborator

idolize commented May 27, 2015

Still having issues building the docs on the latest version and on multiple computers.

npm ERR! argv "node" "/usr/local/bin/npm" "run" "dev"
npm ERR! node v0.12.2
npm ERR! npm  v2.7.5
npm ERR! code ELIFECYCLE
npm ERR! react-google-maps@1.3.1 dev: `cd examples/gh-pages && npm i && npm run dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-google-maps@1.3.1 dev script 'cd examples/gh-pages && npm i && npm run dev'.
npm ERR! This is most likely a problem with the react-google-maps package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     cd examples/gh-pages && npm i && npm run dev
npm ERR! You can get their info via:
npm ERR!     npm owner ls react-google-maps
npm ERR! There is likely additional logging output above.

@sanjaydev
Copy link

0 info it worked if it ends with ok
1 verbose cli [ 'c:\Program Files\nodejs\node.exe',
1 verbose cli 'c:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm@2.11.2
3 info using node@v0.12.5
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart reactmodules@1.0.0
6 info start reactmodules@1.0.0
7 verbose unsafe-perm in lifecycle true
8 info reactmodules@1.0.0 Failed to exec start script
9 verbose stack Error: reactmodules@1.0.0 start: webpack-dev-server --hot
9 verbose stack Exit status 1
9 verbose stack at EventEmitter. (c:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:213:16)
9 verbose stack at EventEmitter.emit (events.js:110:17)
9 verbose stack at ChildProcess. (c:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack at ChildProcess.emit (events.js:110:17)
9 verbose stack at maybeClose (child_process.js:1015:16)
9 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
10 verbose pkgid reactmodules@1.0.0
11 verbose cwd c:\D-DRIVE-DATA\React\React-Modules
12 error Windows_NT 6.3.9600
13 error argv "c:\Program Files\nodejs\node.exe" "c:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
14 error node v0.12.5
15 error npm v2.11.2
16 error code ELIFECYCLE
17 error reactmodules@1.0.0 start: webpack-dev-server --hot
17 error Exit status 1
18 error Failed at the reactmodules@1.0.0 start script 'webpack-dev-server --hot'.
18 error This is most likely a problem with the reactmodules package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error webpack-dev-server --hot
18 error You can get their info via:
18 error npm owner ls reactmodules
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

getting error while running npm start command

@sanjaydev
Copy link

I have added

"scripts": {
"start": "webpack-dev-server --hot"
},

to start webpack

@datctbk
Copy link

datctbk commented May 11, 2018

@tomchentw
it works! thanks

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

Successfully merging a pull request may close this issue.

6 participants